I have been coding a basic calculator in python 3.3 and I want to be able to run it in command window.
but as soon as i get to the end it shuts the windows before I have time to view the final answer.
so I was wondering if there is an equivalent to the c++ System('PAUSE') command to tell it not to go any further until the user is ready.
Here is my calculator code:
print('Your Very Own Basic Calculator')
first_num = int(input('Please Enter The First Number: '))
second_num = int(input('Please Enter The Second Number: '))
Equation = input('What would you like to do, multiplication, division, subtraction or
if Equation == ('*'):
addition? *, /, -, +')
print('The Answer is',first_num * second_num)
elif Equation == ("/"):
print('The Answer is',first_num / second_num)
elif Equation == ('-'):
print('The Answer is',first_num - second_num)
elif Equation == ('+'):
print('The Answer is',first_num + second_num)
thanks
Use input()
on p3k or raw_input()
on p2.7x - it will read anything from stdin, so it will wait until user is ready.
as of today this is working under win7 :
import os
(...)
os.system("PAUSE")
Watch out the caps in the snippet, pause is not PAUSE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With