kbjradmin
New Member
- Messages
- 512
- Reaction score
- 2
- Points
- 0
i am a student taking a python course, and for one of my assignments i have come up with this:
i can't get the end part to work right, though.
the whole rest of the program works, but when i tell the program to restart, it doesn't.
please help
Edit:
nevermind, i figured out the problem.
at the end i needed a raw_input, not a regular input.
Code:
## assignmentOne.py
## requests input from the user and then prints out the result for a math equation.
def main():
print "This program requests two inputs from the user, adds the values,"
print "and prints the result."
print
x = float(input("Please enter the first value: "))
y = float(input("Please enter the second value: "))
print
print "The value of", x, "+", y, "is", x+y
print
if input("Type 'restart' to start over or 'done' to quit: ") == "restart":
main()
else:
end()
def end():
print "Good Bye!"
main()
i can't get the end part to work right, though.
the whole rest of the program works, but when i tell the program to restart, it doesn't.
please help
Edit:
nevermind, i figured out the problem.
at the end i needed a raw_input, not a regular input.
Last edited: