Re: [Tutor] how come this doesnt work

2011-01-15 Thread Alex Hall
On 1/15/11, Alan Gauld wrote: > "Alex Hall" wrote > >> m=int(m) >> just before the if statement. This causes m to turn from a string >> into >> an integer and is what is known as "casting" or "type casting", if I >> have my vocabulary correct. > > Sadly you don't although its a common error. > >

Re: [Tutor] how come this doesnt work

2011-01-15 Thread Alan Gauld
"Alex Hall" wrote m=int(m) just before the if statement. This causes m to turn from a string into an integer and is what is known as "casting" or "type casting", if I have my vocabulary correct. Sadly you don't although its a common error. This is type conversion. You are actually changing

Re: [Tutor] how come this doesnt work

2011-01-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, walter weston wrote: I generate a random number(supposedly a password, in my case its just a long floating point lol),I want the user to reinput that number and I want to print a string if the number entered is correct. so if m==num(num is the number generated and m

Re: [Tutor] how come this doesnt work

2011-01-14 Thread Noah Hall
Adding reply to list - On Sat, Jan 15, 2011 at 2:55 AM, walter weston wrote: > I only want to generate a random number once > Then you don't need a for loop. Think of a for loop as something you need when you want to run a piece of code several times, for example for x in range(1,6): print('

Re: [Tutor] how come this doesnt work

2011-01-14 Thread Noah Hall
> import random > for x in range(0,1): >     num = random.random() >     print (num) >     m=input('input pass:') >     if m==num: >     print('you entered correctly, proceed') Your problem lines in the differences in between the types - your num variable is a float, whereas your m variable i

Re: [Tutor] how come this doesnt work

2011-01-14 Thread Alex Hall
On 1/14/11, walter weston wrote: > > I generate a random number(supposedly a password, in my case its just a long > floating point lol),I want the user to reinput that number and I want to > print a string if the number entered is correct. so if m==num(num is the > number generated and m is the va

[Tutor] how come this doesnt work

2011-01-14 Thread walter weston
I generate a random number(supposedly a password, in my case its just a long floating point lol),I want the user to reinput that number and I want to print a string if the number entered is correct. so if m==num(num is the number generated and m is the variable which stores the input ) then I w