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
Hey all,
Thought I'd try a mini-calc.Here's the code:
# This is a small calculator.print "Mini Calculator"print "By
Nathan Pinno"printprint "CALCULATE MENU"print "1) Add"print
"2) Subraction"print "3) Multiplication"print "4) Division w/o
remainder"print "5) Division with
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
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