[Tutor] Adding consecutive numbers

2015-04-27 Thread Whom Isac
Hi, I am trying to build a python mini program to solve a math problem . I
wanted my program to ask two number from the operator and it can add those
number as a integer but as consecutive number in range. For example, if
num1 entry =1 & num2 entry = 100 , the program should be adding number from
1 to 100 together(which should equal to 5050). I thought that I could use
range() to use it for any given input from the user. However, there are few
argumentation error and I don't know why my bool function did not work in
while loop. Is there any way to make the program more concise.
I have uploaded my code file below. Please, note that I am fairly new to
programming and donot use complex modules, therefore, suggest me where I
was wrong with the code. I have checked for indentation error, however,
there were no error. So, I don't have any idea about the error.
Thanks.

##Goal: Building a math program, which allows addition of two numbers in range 
in consequitive
## sequence e.g. 1+2...+n

if __name__=='__main__':
interact()

def iteract():
print('''Welcome to My new Math program!! 
With this program, you can find the sum of any consequitive numbers.''')
print('So Just add your numbers in following spaces')
x =int(input('Please enter your first number: '))
y =int(input('Please enter your second number: '))
while True:
if x___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Re: Adding consecutive numbers

2015-05-06 Thread Whom Isac
Thanks, Steven. I think you are right about those mistake. But you could
tell that the code was incomplete so the interact() was not defined. I have
updated some parts (basically writing from the scratch). I am busy with a
new project and learning how to create GUI app in python, although there
are not enough source to aid me. I will just post the code here for now:
Thanks, Steven. I think you are right about those mistake. But you could
tell that the code was incomplete so the interact() was not defined. I have
updated some parts (basically writing from the scratch). I am busy with a
new project and learning how to create GUI app in python, although there
are not enough source to aid me. I will just post the code here for now:


##Goal: Building a math program.
## two nums will be asked by the user
## they will be added
## condition: num >=o:
## num will continue to be added into a list untill the second number
## For your information, a consequitive sequence of num : num-->1 num1-->
num+1...+n

if __name__=='__main__':
interact()

def interact():
print('''Welcome to My new Math program!!
With this program, you can find the sum of any consequitive numbers.''')
print('So Just add your numbers in following spaces')
## If anybody complaining about this function. I will have to say, that
the coding is incomplete so
## I will first define all my function then def interact() when I am
finishing.


def getting_numbers(first_num, second_num):
x = [] #This is a empty list to store data
y = [] #This is a empty list to store data

"""Getting the user values:"""

first_num =int(input('Please enter your first number: '))
x.append(first_num) # adding the input in x#
second_num =int(input('Please enter your second number: '))
y.append(second_num) # adding the input in x#
z =(x,y) # This is a touple containing both x and y value.
return z

def adding_all(x):
total = 0
for num in x:
total +=num
return total

def remove_letter(x):
if x != len(x):
print('You did not enter a number')
elif x != adding_all(x):
print("Please, donot include letters")
else:
return x
## I think using a while True function to iterate all item in x
would be better.



def adding_number(x,y):
start = x[0]
end = y[0]
new_x = 0
new_x_1 = 0
while x[0]<=y[0] or x[0]<= 0:
if x[0]==0:
new_x+=1
return new_x
elif x[0]>0 or x[0]https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] FW: query

2015-06-25 Thread Whom Isac
*def *odd_or_even():
X=input("Enter the number which you want to check for odd and even: ")
number=int(X)
print("The number %s is ODD."%(number) *if *number%2!=0 *else *"The
number %s is EVEN."%(number))

On Thu, Jun 25, 2015 at 1:53 PM, Whom Isac  wrote:

> Hi, abhijeet...@yahoo.in:
> there is four or five ways to do your question as I had done one for you
> before. As you could tell there are also a shorter version to do this,
> using list comprehension method. I would recommend you to use codeacademy
> if you are not sure. Here is a quickest way for the ODD/EVEN list
> comprehension. Both works the same way too.
>
>
> def odd_or_even():
> X=input("Enter the number which you want to check for odd and even: ")
> number=int(X)
> print("The %s is ODD"%(number)if number%2!=0 else "The %s is 
> EVEN"%(number))
>
>
> On Thu, Jun 25, 2015 at 1:47 PM, Whom Isac  wrote:
>
>> Yes, I agree with Alan Gauld.
>>
>> For Gupta's case:
>>
>>  if you wanted to get your point across you should mention your intention
>> and could have posted any error message along with your code. Because, your
>> question is vague and if the original script of the code had been posted,
>> that would have been a huge help.
>>
>> And, for abhijeet...@yahoo.in:
>>
>> Is that any section of the function?? If it is then please, repost your
>> question with full definition of the function and please read python's rule
>> to indentation, maybe that's where the error is. However, as you said your
>> function execute normally, therefore I am assuming you misunderstood how
>> while loops works. Note for you: I don't think there would be any exception
>> raise for ValueError in your code so try: and except: method would not be
>> necessary..
>>
>> For a simple odd and even finder I would try to do this:
>>
>> """ODD or EVEN Finder: """
>>
>> def odd_or_even():
>> X=input("Enter the number which you want to check for odd and even: ")
>> number=int(X)
>> while True:
>> if number%2==0:
>> print("The number ", number, " is Even.")
>> #number +=1
>> else:
>> print("The number ",number, " is Odd")
>> break
>> pass
>>
>>
>>
>>
>> On Thu, Jun 25, 2015 at 2:27 AM, Alan Gauld 
>> wrote:
>>
>>> On 24/06/15 13:58, abhijeet...@yahoo.in wrote:
>>>
>>>> Hey guys can anybody tell me what's wrong with this code: The code is
>>>> below?
>>>>
>>>
>>> Please in future
>>> 1) start a new thread with a new post, do not hijack somebody else's
>>> query. It messes up the archive and threaded mail/newsreaders
>>>
>>> 2) Use plain text for posting code, your post is all messed up by the
>>> mail system so we can't see the code clearly. It is all on one line...
>>>
>>>  Actually the point is that when we put "34h4" type of value
>>>>
>>> > it's an valueerror but here no handling is been performed
>>>
>>> The handling only happens if it occurs inside a try block. It looks as
>>> if your type conversion (int(...)) happens outside the try block.
>>> The error is raised by the type conversion.
>>>
>>>  while 1:number=int(input("Enter the number which u want to check
>>>> for odd and even :"))try :if number%2==0:print("The
>>>> number",number ," is Even")else:print("The number
>>>> ",number ," is Odd")  except  ValueError:print("Invalid
>>>> Input")
>>>>
>>>
>>> Finally, handling an error by simply printing a bland error message
>>> is usually not a good idea. You effectively hide a lot of valuable
>>> debugging information. You would be better to just let Python print
>>> out its usual, much more helpful, error message.
>>>
>>> (The exception is where it's the top level of an end-user program
>>> where the Python trace might scare the users. But that should only
>>> be after you have thoroughly debugged it and handled most of the
>>> likely problem scenarios, and hopefully logged the error data
>>> into a logfile or sent it as an email to your support desk.)
>>>
>>>
>>> --
>>> Alan G
>>> Author of the Learn to Program web site
>>> http://www.alan-g.me.uk/
>>> http://www.amazon.com/author/alan_gauld
>>> Follow my photo-blog on Flickr at:
>>> http://www.flickr.com/photos/alangauldphotos
>>>
>>>
>>> ___
>>> Tutor maillist  -  Tutor@python.org
>>> To unsubscribe or change subscription options:
>>> https://mail.python.org/mailman/listinfo/tutor
>>>
>>
>>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] FW: query

2015-06-25 Thread Whom Isac
For abhijeet...@yahoo.in:
I had posted few solution to your question before but unfortunately they
were sent to Alan Gauld mail because I am not used to the tutor@python.org
mail system.
Here is the code that will work:
""ODD/EVEN finder:"""


def odd_or_even():
X=input("Enter the number which you want to check for odd and even: ")
try:
number=int(X)
print("The number %s is ODD."%(number)if number%2!=0 else "The
number %s is EVEN."%(number))
except ValueError:
print("Invalid input")


On Thu, Jun 25, 2015 at 1:59 PM, Whom Isac  wrote:

> *def *odd_or_even():
> X=input("Enter the number which you want to check for odd and even: ")
> number=int(X)
> print("The number %s is ODD."%(number) *if *number%2!=0 *else *"The
> number %s is EVEN."%(number))
>
> On Thu, Jun 25, 2015 at 1:53 PM, Whom Isac  wrote:
>
>> Hi, abhijeet...@yahoo.in:
>> there is four or five ways to do your question as I had done one for you
>> before. As you could tell there are also a shorter version to do this,
>> using list comprehension method. I would recommend you to use codeacademy
>> if you are not sure. Here is a quickest way for the ODD/EVEN list
>> comprehension. Both works the same way too.
>>
>>
>> def odd_or_even():
>> X=input("Enter the number which you want to check for odd and even: ")
>> number=int(X)
>> print("The %s is ODD"%(number)if number%2!=0 else "The %s is 
>> EVEN"%(number))
>>
>>
>> On Thu, Jun 25, 2015 at 1:47 PM, Whom Isac  wrote:
>>
>>> Yes, I agree with Alan Gauld.
>>>
>>> For Gupta's case:
>>>
>>>  if you wanted to get your point across you should mention your
>>> intention and could have posted any error message along with your code.
>>> Because, your question is vague and if the original script of the code had
>>> been posted, that would have been a huge help.
>>>
>>> And, for abhijeet...@yahoo.in:
>>>
>>> Is that any section of the function?? If it is then please, repost your
>>> question with full definition of the function and please read python's rule
>>> to indentation, maybe that's where the error is. However, as you said your
>>> function execute normally, therefore I am assuming you misunderstood how
>>> while loops works. Note for you: I don't think there would be any exception
>>> raise for ValueError in your code so try: and except: method would not be
>>> necessary..
>>>
>>> For a simple odd and even finder I would try to do this:
>>>
>>> """ODD or EVEN Finder: """
>>>
>>> def odd_or_even():
>>> X=input("Enter the number which you want to check for odd and even: ")
>>> number=int(X)
>>> while True:
>>> if number%2==0:
>>> print("The number ", number, " is Even.")
>>> #number +=1
>>> else:
>>> print("The number ",number, " is Odd")
>>> break
>>> pass
>>>
>>>
>>>
>>>
>>> On Thu, Jun 25, 2015 at 2:27 AM, Alan Gauld 
>>> wrote:
>>>
>>>> On 24/06/15 13:58, abhijeet...@yahoo.in wrote:
>>>>
>>>>> Hey guys can anybody tell me what's wrong with this code: The code is
>>>>> below?
>>>>>
>>>>
>>>> Please in future
>>>> 1) start a new thread with a new post, do not hijack somebody else's
>>>> query. It messes up the archive and threaded mail/newsreaders
>>>>
>>>> 2) Use plain text for posting code, your post is all messed up by the
>>>> mail system so we can't see the code clearly. It is all on one line...
>>>>
>>>>  Actually the point is that when we put "34h4" type of value
>>>>>
>>>> > it's an valueerror but here no handling is been performed
>>>>
>>>> The handling only happens if it occurs inside a try block. It looks as
>>>> if your type conversion (int(...)) happens outside the try block.
>>>> The error is raised by the type conversion.
>>>>
>>>>  while 1:number=int(input("Enter the number which u want to check
>>>>> for odd and even :"))try :if number%2==0:
>>>>

Re: [Tutor] FW: query

2015-06-25 Thread Whom Isac
Sorry, the interpreter uses colour which is why some code is missing. Here
is the text version of my code:


def odd_or_even():
X=input("Enter the number which you want to check for odd and even: ")
try:
number=int(X)
print("The number %s is ODD."%(number)if number%2!=0 else "The
number %s is EVEN."%(number))
except ValueError:
print("Invalid input")

On Thu, Jun 25, 2015 at 2:06 PM, Whom Isac  wrote:

> For abhijeet...@yahoo.in:
> I had posted few solution to your question before but unfortunately they
> were sent to Alan Gauld mail because I am not used to the tutor@python.org
> mail system.
> Here is the code that will work:
> ""ODD/EVEN finder:"""
>
>
> def odd_or_even():
> X=input("Enter the number which you want to check for odd and even: ")
> try:
> number=int(X)
> print("The number %s is ODD."%(number)if number%2!=0 else "The number 
> %s is EVEN."%(number))
> except ValueError:
> print("Invalid input")
>
>
> On Thu, Jun 25, 2015 at 1:59 PM, Whom Isac  wrote:
>
>> *def *odd_or_even():
>> X=input("Enter the number which you want to check for odd and even: ")
>> number=int(X)
>> print("The number %s is ODD."%(number) *if *number%2!=0 *else *"The
>> number %s is EVEN."%(number))
>>
>> On Thu, Jun 25, 2015 at 1:53 PM, Whom Isac  wrote:
>>
>>> Hi, abhijeet...@yahoo.in:
>>> there is four or five ways to do your question as I had done one for you
>>> before. As you could tell there are also a shorter version to do this,
>>> using list comprehension method. I would recommend you to use codeacademy
>>> if you are not sure. Here is a quickest way for the ODD/EVEN list
>>> comprehension. Both works the same way too.
>>>
>>>
>>> def odd_or_even():
>>> X=input("Enter the number which you want to check for odd and even: ")
>>> number=int(X)
>>> print("The %s is ODD"%(number)if number%2!=0 else "The %s is 
>>> EVEN"%(number))
>>>
>>>
>>> On Thu, Jun 25, 2015 at 1:47 PM, Whom Isac  wrote:
>>>
>>>> Yes, I agree with Alan Gauld.
>>>>
>>>> For Gupta's case:
>>>>
>>>>  if you wanted to get your point across you should mention your
>>>> intention and could have posted any error message along with your code.
>>>> Because, your question is vague and if the original script of the code had
>>>> been posted, that would have been a huge help.
>>>>
>>>> And, for abhijeet...@yahoo.in:
>>>>
>>>> Is that any section of the function?? If it is then please, repost your
>>>> question with full definition of the function and please read python's rule
>>>> to indentation, maybe that's where the error is. However, as you said your
>>>> function execute normally, therefore I am assuming you misunderstood how
>>>> while loops works. Note for you: I don't think there would be any exception
>>>> raise for ValueError in your code so try: and except: method would not be
>>>> necessary..
>>>>
>>>> For a simple odd and even finder I would try to do this:
>>>>
>>>> """ODD or EVEN Finder: """
>>>>
>>>> def odd_or_even():
>>>> X=input("Enter the number which you want to check for odd and even: ")
>>>> number=int(X)
>>>> while True:
>>>> if number%2==0:
>>>> print("The number ", number, " is Even.")
>>>> #number +=1
>>>> else:
>>>> print("The number ",number, " is Odd")
>>>> break
>>>> pass
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Jun 25, 2015 at 2:27 AM, Alan Gauld 
>>>> wrote:
>>>>
>>>>> On 24/06/15 13:58, abhijeet...@yahoo.in wrote:
>>>>>
>>>>>> Hey guys can anybody tell me what's wrong with this code: The code is
>>>>>> below?
>>>>>>
>>>>>
>>>>> Please in future
>>>>> 1) start a new thread with a new post, do not hijack somebody else's
>>>>> query. It messes up the archive and threaded mail/newsreaders
>>>>>
>&g

[Tutor] Not sure why the code is giving weird result?

2016-01-09 Thread Whom Isac
Hi, today I tried to help with one of the request in Python tutor about
trailing zeros -6days old.
I don't know why my code is incrementing in number.
Here is the code:

def factorial():
print("Here you will put your factorial")
factVar=int(input("Please input what number to be factorial: \t"))
TValue=0
for i in range(0,factVar+1):
TValue+=i*i+1
print("Your total factorial: "+str(TValue))
return TValue


def trailing_zeros():
   value=factorial()
   dvdVal=1
   divider=1
   totalTrailingZeroes=0

   while dvdVal !=0:
   try:
   answer=0
   answer=int(value/5**(divider))
   totalTrailingZeroes+=answer
   while answer !=0:
   if answer >0:
   answer=int(value/5**(divider+1))
   newanswer=round(answer,1)
   totalTrailingZeroes+=newanswer
   elif answer <=0:
   dvdVal=0
   print(str(TrailingZeroes))


   except Exception:
   print("Sorry About that")


trailing_zeros()



Here is what I tried After ward


###And here is why I tried Afterwards

def factorial():
print("Here you will put your factorial")
factVar=int(input("Please input what number to be factorial: \t"))
TValue=0
for i in range(0,factVar+1):
TValue+=i*i+1
print("Your total factorial: "+str(TValue))

value=TValue
dvdVal=1
divider=1
totalTrailingZeroes=0

answer=int(value/5**(divider))
totalTrailingZeroes+=answer
newanswer=round(answer,1)
while newanswer !=0:
if newanswer >0:
answer=int(value/(5**(divider+1)))
newanswer=round(answer,1)
totalTrailingZeroes+=newanswer
print(str(totalTrailingZeroes))
else:
newanswer=0
print(str(TrailingZeroes))
factorial()

"""
def trailing_zeros():
   value=factorial()
   dvdVal=1
   divider=1
   totalTrailingZeroes=0

   while dvdVal !=0:
   try:
   answer=0
   answer=value/5**(divider)
   totalTrailingZeroes+=answer
   while answer !=0:
   if answer >0:
   answer=value/5**(divider+1)
   newanswer=round(answer,1)
   totalTrailingZeroes+=newanswer
   elif answer <=0:
   dvdVal=0
   print(str(TrailingZeroes))


   except Exception:
   print("Sorry About that")


trailing_zeros()

"""
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Creating a webcrawler

2016-01-09 Thread Whom Isac
Hi I want to create a web-crawler but dont have any lead to choose any
module. I have came across the Jsoup but I am not familiar with how to use
it in 3.5 as I tried looking at a similar web crawler codes from 3.4 dev
version.
I just want to build that crawler to crawl through a javascript enable site
and automatically detect a download link (for video file)
.
And should I be using pickles to write the data in the text file/ save file.
Thanks
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] creating a mspaint utility

2016-01-14 Thread Whom Isac
Hi, I was wondering if it is possible to make a similar drawing tool with
basic functionality to draw lines, circles or square with python canvas.
I know how to draw them with canvas very well but the problem is the way I
am getting my mouse positions (initial& final).
I did not think it would have been a difficult work but I have spent 3-4
hours and out of luck. I get my functions to give me the mouse position
while moving, when pressed, original position or current position. But
don't know how to store them as a value. Should I write a function to store
them inside of it. I don't know because I had tried doing just that
recursively and failed and unfortunately I erased that part in the process.
I am not a genius and is not used to tkinter very well (to use command
function or anything) to store a value.
Here is my code. I kind of left some reduntant codes to show my try and
fail situation. Thus my code is quite long.

__author__ = 'WHOM ISAC'
import tkinter as tk
from tkinter import *
import sys
#import time

#app GUI
app=tk.Tk()
app.title("MSPAINT By Shams")
app.geometry('400x450')

#
show_event=app.winfo_pointerxy()
(X,Y)=show_event

#Mouse events
def original_mouse_position():
show_event=app.winfo_pointerxy()
(X,Y)=show_event
print("The mouse are on: X:{0} Y:{1}".format(X,Y))
label0=Label(frame1,text="Original Position",
relief=RAISED).pack(side=TOP,anchor="ne")
label=Label(frame1,text="XY",relief=GROOVE).pack(side=BOTTOM,
anchor="ne")
label1=Label(frame1,text=str(show_event),
relief=SUNKEN).pack(side=BOTTOM, anchor="ne")
return

# Continuous Mouse Movement

def motion(event):
x, y = event.x, event.y
currentMousePosition=(x,y)
print('MousePos: X:{0} Y:{1}'.format(x, y))
return currentMousePosition
###app.bind('', motion)-->WORKS but disabled from running



#Mouse Update And Position
def mouse_position():
show_event=app.winfo_pointerxy()
(X,Y)=show_event
if ''!=show_event :
show_event=app.winfo_pointerxy()
(X,Y)=show_event
print("Current mouse are on: X:{0} Y:{1}".format(X,Y))
label2=Label(frame1,text=str(show_event),
relief=GROOVE).pack(side=RIGHT)

#app.bind(mouse_position(),'Show')

#Mouse pressed
def Mouse_pressed(event):
print("Right Click has been pressed.")
initialpos=(X,Y)
initialpos=app.winfo_pointerxy()
#finalpos=motion(event)
"""
while initialpos!=(0,0):
initialpos=app.winfo_pointerxy()   #Explain me why
it does not work.Should not it work?it's logical to do/call recursive
finalpos=(0,0)
if initialpos !=finalpos:
if Mouse_pressed(event):
finalpos=app.winfo_pointerxy()
print(initialpos)
"""
print(initialpos)
return initialpos


#Mouse coordination
"""
initial_pos=Mouse_pressed
print(initial_pos)
time.sleep(1)
final_pos=Mouse_pressed
print(final_pos)
"""

#SOME WIDGETS:
lbl0=Label(app, text="This is a program that I have build Using Python.
Please Use it.", fg='blue', font='Times 9 bold').pack(fill=BOTH,anchor='nw')
Frame for Original Mouse Position
frame1=Frame(app, bg='red', width=2).pack(fill=BOTH,anchor='ne')




#Canvas tools
"""CanvasFrame=Frame(app, width=300, height=200)"""
canvas_GUI=Canvas(app, height=300, width=300, bg='white')
   #canvas_draw_tool=canvas_GUI.create_line(20,0,100,200)
canvas_draw_tool=canvas_GUI.create_line(20,0,(X,Y)) #I know it won't work
unless I could get the initial position and final position but I don't have
a clue

##CanvasFrame Binding
canvas_GUI.bind("", Mouse_pressed)
canvas_GUI.bind('', motion)
canvas_GUI.pack()

#QUIT Function
def quit():
print("Quit function has been called. So I am quitting.")
sys.exit()



#CLEAR Function
def clear():
canvas_GUI.delete("all")
print("Everything has been flushed.")



#Buttons
Button(app, text='Quit', command=quit).pack(anchor='sw',side=LEFT)
Button(app, text='Clear', command=clear).pack(anchor='sw',side=LEFT)
Button(app, text='Show', command=mouse_position).pack(anchor='sw',side=LEFT)
"""
initial_pos=Label(app,text="Initial
pos:{}".format(app.winfo_pointerxy())).pack()
final_pos=Label(app,text="Final
pos:{}".format(app.winfo_pointerxy())).pack()
canvas_GUI.bind(Mouse_pressed,initial_pos)
canvas_GUI.bind(Mouse_pressed,final_pos)
"""
#Mainloop running
original_mouse_position()
app.mainloop()
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Creating a webcrawler

2016-01-14 Thread Whom Isac
Thanks guys for your replies. I actually tried playing with my browser but
getting a web crawler to select a video and fetch the video link was not
helpful or should I say very hard for me as I am just a beginner level
programmer and python was the first language I learnt. I also learnt
javascript, ruby and html, bootstrap, C# recently. I may try this same
project in future with more knowledge.

On Sun, Jan 10, 2016 at 2:33 AM, bruce  wrote:

> Hi Isac.
>
> I'm not going to get into the pythonic stuff.. People on the list are
> way better than I.  I've been doing a chunk of crawling, it's not too
> bad, depending on what you're trying to accomplish and the site you're
> targeting.
>
> So, no offense, but I'm going to treat you like a 6 year old (google
> it - from a movie!)
>
> You need to back up, and analyze the site/pages/structure you're going
> after. Use the tools - firefox - livehttpheaders/nettraffic/etc..
>   -you want to be able to see what the exchange is between the
> client/browser, as well as the server..
>   -often, this gives you the clues/insite to crafting the request from
> your client back to the server for the item/data you're going for...
>
> Once you've gotten that together, setup the basic process with
> wget/curl etc to get a feel for any weird issues - cert issues?
> -security issues - are cookies required - etc.. A good deal of this
> stuff can be resolved/checked out at this level, without jumping into
> coding..
>
> Once you're comfortable at this point, you can crank out some simple
> code to go after the site you're targeting.
>
> In the event you really have a javascript/dynamic site that you can't
> handle in any other manner, you're going to need to go use a 'headless
> browser' process.
>
> There are a number of headless browser projects - I think most run on
> the webit codebase (don't quote me). Casper/phantomjs, there are also
> pythonic implementations as well...
>
> So, there you go, should/hopefully this will get you on your way!
>
>
>
> On Fri, Jan 8, 2016 at 9:01 PM, Whom Isac  wrote:
> > Hi I want to create a web-crawler but dont have any lead to choose any
> > module. I have came across the Jsoup but I am not familiar with how to
> use
> > it in 3.5 as I tried looking at a similar web crawler codes from 3.4 dev
> > version.
> > I just want to build that crawler to crawl through a javascript enable
> site
> > and automatically detect a download link (for video file)
> > .
> > And should I be using pickles to write the data in the text file/ save
> file.
> > Thanks
> > ___
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PLEASE I NEED HELP URGENTLY

2016-01-14 Thread Whom Isac
@precious Akams.
I don't know if you have tried to look for any resources e.g. python
directory to help you with this small syntax error. And I don't see
any relevance information with your callback error message with your
code. How did you able to run it?? I have not been reading my mails in
a while so I just honestly did not wanted upset you with anymore
words.
I felt you should learn to take a little bit precaution while coding.
Here is my Solution which I don't think you are using to pass or to
have cheated your homework:
class BankAccount(object):
def __init__(self, initial_amount):
self.balance=initial_amount
def deposit (self, amount):
self.balance+=amount
def withdraw (self, amount):
if self.balance>=amount:
return ('invalid transaction')
else:
#What are trying to do eg.
self.balance=self.balance-amount
return self.balance
pass

MinimumBalanceAcc=BankAccount #---> This created an instances
#To create a subclass
class MinimumBalanceAccount(BankAccount):
#You don't need to call the init function if you are just trying
to use Bank account functions
# add any other additional methods below:
#eg.
def show_balance(self):
print(str(self.balance))


On Thu, Jan 14, 2016 at 6:52 AM, Tim Golden  wrote:
>
> On 13/01/2016 20:51, Tim Golden wrote:
>>
>> Speaking as the list moderator in question over there: if I might
>> moderate Mark's well-known zeal...
>
>
> (Absolutely no pun intended!)
>
>
> TJG
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Calculate 4**9 without using **

2017-03-04 Thread Whom Isac
Hi there. So if you want to make a function for exponent (e^x)  rather than 
power such as x**n, then you need to use/import pythons math module such as 
Numpy. 

Use: 
import numpy as np
List = [1,2,3,4,5]
np.exp(list) 

This would give exponential value of each x in the list.

If you want to just power by a certain base then use:

def powerBase(base,n):
  return base**n

Example print(powerBase(2,3)) should give you 8.

That should also do that for you.

On Mar 5, 2017, 3:37 AM, at 3:37 AM, Sri Kavi  wrote:
>Hi,
>
>
>I'm a beginner learning to program with Python. I'm trying to explain a
>solution in plain English. Please correct me if I'm wrong.
>
>
>Create a function that takes base and exponent as arguments.
>
>
>
>In the body of the function:
>
>set a result variable to the base.
>
>
>
>User a for-loop with a range of 1 to the exponent.
>
>With each iteration, set the result to the product of result times
>base.
>
>
>
>After the loop, return the result.
>
>
>
>Call the function.
>
>
>
>
>
>Regards
>Sri
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with some code for my 8 year old! Thank you.

2018-02-03 Thread Whom Isac
Sorry can't see any error messages through the visible links.

On 3 Feb. 2018, 7:08 pm, at 7:08 pm, JSelby  wrote:
> My 8 year old is reading  Python for kids and is trying a few programs
>from the book We are working on a Mac  OS X ELCapitain.  We are looking
>at
>   WHACK THE BOUNCING BALL.
>He has copied the code  below and we get the red error message below.
>We
>followed the code exactly so are not sure what is wrong. Please can you
>   help.
>   Object: [1]application/x-apple-msg-attachment
>   Object: [2]application/x-apple-msg-attachment
>   Julie Selby
>   [3]ju...@beaglestrategy.com
>   Tel: 604 762 1968
>   [4]http://ca.linkedin.com/in/julieselby/
>   [5]www.beaglestrategy.com
>
>References
>
>   Visible links
> 1. file:///tmp/cid:BC5630A8-FD4A-488B-9979-8A8936D74EC7@hitronhub.home
> 2. file:///tmp/cid:80B89FF3-BA17-444D-8E95-8C63CCF4851F@hitronhub.home
>   3. mailto:ju...@beaglestrategy.com
>   4. http://ca.linkedin.com/in/julieselby/
>   5. http://www.beaglestrategy.com/
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor