Mar-10-2019, 09:15 AM
(Dec-29-2017, 08:04 PM)Solstice Wrote: A simple calculator, for simple calculations.
print("simple calculator by Solstice") print("I-----I") print("I00000I") print("I-----I") print("I1 2 3I") print("I4 5 6I") print("I7 8 9I") print("I-----I") print(" ") print("when the program asks for +- x : type restart to make some space") f=1 while f==1: c=input("+/-/x/:?") if c=="+": x=input("first number ") y=input("number to add ") z=int(x)+int(y) print(z) input("results(Enter to continue)") if c=="-": x=input("first number ") y=input("minus which number? ") z=int(x)-int(y) print(z) input("results(Enter to continue)") if c=="x": x=input("first number ") y=input("times what? ") z=int(x)*int(y) print(z) input("results(Enter to continue)") if c==":": x=input("first number ") y=input("divided by which number? ") z=int(x)/int(y) print(z) input("results(Enter to continue)") if c=="restart": print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print(" ") print("===========================================================") print("I New calculation I") print("===========================================================")
Nice program but i would have coded in just a single line.
user = eval(input("Enter a number : ")) #for eg "2/3" or "2*3" or "2+2" print(user)