Re: [Tutor] Why does my code show this?

2005-07-11 Thread Nathan Pinno
  Thanks to all in the group. Mini_calc is now up and running successfully 
and is now available to download from my site.

  Thanks again,
  Nathan
  - Original Message - 
  From: Alan G [EMAIL PROTECTED]
  To: Nathan Pinno [EMAIL PROTECTED]; tutor@python.org
  Sent: Sunday, July 10, 2005 5:03 PM
  Subject: Re: [Tutor] Why does my code show this?


cal_opt = int(raw_input(What option would you like: ))
  
   Here you get the input and convert it to a number (int() )
   which is fine.
  
if cal_opt == 1:
  
   But here you compare it to a string (see the quotes).
  
   So either remove the convertion to int() around raw_input or
   remove the quotes around the values. The things you compare
   must be the same type.
  
That's not an option. Try again.
Option: 3
3*4
12
  
   I'm not sure how the multiplication appeared though!
  
   Alan G.
  
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why does my code show this?

2005-07-10 Thread geon




Nathan Pinno napsal(a):

  
  
  
  
cal_opt = int(raw_input("What option would you like: "))
if cal_opt == "1":
   ..

  



your problem is in these two lines (and even more, but if you solve
this, the others you get for free).
try run just these two lines and guess, think about what kind of
variable is in cal_opt.



  
elif cal_opt == "2":
 X = input("First number:" )
 Y = input("Second number:" )
 print X, "-", Y, "= ",X - Y
 cal_opt = int(raw_input("Option: "))

  

the other trouble might be on the last line - note that "if" is not
"while". :-)

before creating your own program would be better to go through some
nice tutorial, to get some experience.

nice pytime
geon



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why does my code show this?

2005-07-10 Thread Alan G
  cal_opt = int(raw_input(What option would you like: ))

Here you get the input and convert it to a number (int() )
which is fine.

  if cal_opt == 1:

But here you compare it to a string (see the quotes).

So either remove the convertion to int() around raw_input or 
remove the quotes around the values. The things you compare 
must be the same type.

  That's not an option. Try again.
  Option: 3
  3*4
  12

I'm not sure how the multiplication appeared though! 

Alan G.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor