Hi, all.

I am currently working on my first Python program but I am having a bit of
trouble with it. The program asks the user to input a number and then it
checks to see if that number is greater than, less than, or equal to seven,
and prints the adequate message.

What I can't figure out is how to get Python to ask the user if they think
that the number they inputed is greater than or less than seven, and then
have Python somehow use that to then calculate the 'if num > 7: print "True"
etc, "etc, etc"' functon (ie. if the user inputs "Yes" or "y" when asked if
they think that the number they inputed - lets say 8 - is greater than 7,
Python will then say "True, 8 is greater than 7." The closest I have gotten
is:

print "Do you think", num, "is greater than 7?"

I would appreciate any helps or tips on this subject ten-fold.

Here is the Python tidbit, for better understanding:

========================
# num.py


print ## blank line
num = raw_input("Enter a number: ")

print "Do you think", num, "is greater than 7?"
if num > 7:
    print "True,", num, "is greater than 7."
elif num < 7:
    print "False,", num, "is not greater than 7."
elif num == 7:
    print "Wait a second, these numbers are the same."
========================

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to