I'm learning python for 2 weeks. So my question is let's say I created a calculator. How can I add number as much as user likes?
os.system("del *.pyc")
print "Hello %s!" % ad
print "---------------------------------------"
print " *Add"
print " *x Add (Dunno english)"
print " *Multiply"
print " *x Multiply (Look up)"
print " *Multiply by itself"
print " *math.sqrt"
print "---------------------------------------"
print "What u want? :)"
choice = raw_input("Secimim= ")
print "So you choose %s :)" % choice
print ""
print "redirecting..."
time.sleep(3)
os.system("cls")
if secim.lower()=="add":
first=input("First number= ")
second=input("Second= ")
print "Result= " + str(add(first,second))
os.system("pause")
Rest of them is same Let's make this part english
print "Let's have your choice :)"
secim = raw_input("Secimim= ")
adsiz = (ad,secim)
print "So you selected this :)" % adsiz
print ""
print "Redirecting..."
time.sleep(3)
os.system("cls")
if secim.lower()=="add":
ilksayi=input("IFirst= ")
ikincisayi=input("Second= ")
print "Result= " + str(toplama(ilksayi,ikincisayi))
os.system("pause")
def toplama(x,y):
return x+y
This part
if secim.lower()=="add":
firstnumber=input("IFirst= ")
secondnumber=input("Second= ")
print "Result= " + str(add(ilksayi,ikincisayi))
os.system("pause")
I want to make it like a loop that it says:
Number=10
Number = 26
Number = 62
...
And when you type
Number= (Blank)
It print the result. Just like the phone's calculators. I tried making it with loop that breaks when user types quit. But I can't declare that much variable. How to make auto making variables?