MaxxB - 1 year ago 76

Python Question

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

Answer Source

Use `input()`

on p3k or `raw_input()`

on p2.7x - it will read anything from stdin, so it will wait until user is ready.