Python Programming

Scyere

Baseband Member
Messages
79
I made a small program that uses everything I know about python (which isn't a lot). Can someone take a look at it, then tell me other things I need to know, as well as links as to where I can study that specific subject?

Code:
close = 'N'
while close == 'N':
    print "Hello, World!"
    close = raw_input("Do you wish to exit? (Y) yes (N) no ")
    if close == 'Y':
        print "Goodbye!"
        break
    elif close == 'N':
        close = 'N'
    else:
        print "Invalid"
        close = 'N'
print "Now you've entered the calculator part."
fnum = input("  Please enter your first number: ")
snum = input("  Please enter your second number: ")
choice = raw_input("  Please choose what you wish to do (+) add (-) subtract (x or *) multiply (/) divide ")
if choice == '+':
    print "Your total is: ", fnum + snum , "!"

elif choice == '-':
    print "Your total is: ", fnum - snum , "!"

elif choice == '*':
    print "Your total is: ", fnum * snum , "!"

elif choice == 'x':
    print "Your total is: ", fnum * snum , "!"

elif choice == '/':
    print "Your total is: ", fnum / snum , "!"

else:
    print "Invalid!"
 
Top