![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Apr 2005
Posts: 7
Rep Power: 0
![]() |
Newbie quesiton: variable assigment
In the Python Shell:
newnum = num % 2 works fine, but when used in a super simple script it get an error: newnumb = num % 2 TypeError: not all arguments converted during string formatting print "This program checks to see if a number is prime, "
num = raw_input("Choose a number: ")
newnumb = num % 2
if newnumb != 0:
print "The number ", num, " is not a prime. "
else:
print "Congrats! The number ", num, " is a prime. "Just learnign Python, thanks in advance acab |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|