Python 空闲重启
Python IDLE restart
我正在尝试 运行 我在 IDLE 中的代码 Python 我写的一切都是正确的,但遗憾的是我不能 运行。
无故重启。
def calculator():
operation = input('''
Please Enter one of These:
+ for adding
- for minize
* for multiply
/ for devision
''')
num1 = int(input('Num 1 : '))
num2 = int(input('Num 2 : '))
if operation == '+':
print(' {} + {} = ' . format(num1 , num2))
print(num1 + num2)
elif operation == '-':
print(' {} - {} = ' . format(num1 , num2))
print(num1 - num2)
elif operation == '*':
print(' {} * {} = ' . format('num1 , num2'))
print(num1 * num2)
elif operation == '/':
print(' {} / {} = ' . format('num1 , num2'))
print(num1 / num2)
else:
print('Error')
again()
def again():
calc_again = input('''
Wanna Try Again:
if yes please type Y and if no Please Type N
''')
if calc_again.upper() == 'Y':
calculator()
elif calc_again.upper() == 'N':
print('Good Bye')
else:
again()
您必须调用 calculator() 方法来启动程序(检查最后一行)..
def calculator():
operation = input('''
Please Enter one of These:
+ for adding
- for minize
* for multiply
/ for devision
''')
num1 = int(input('Num 1 : '))
num2 = int(input('Num 2 : '))
if operation == '+':
print(' {} + {} = ' . format(num1 , num2))
print(num1 + num2)
elif operation == '-':
print(' {} - {} = ' . format(num1 , num2))
print(num1 - num2)
elif operation == '*':
print(' {} * {} = ' . format('num1 , num2'))
print(num1 * num2)
elif operation == '/':
print(' {} / {} = ' . format('num1 , num2'))
print(num1 / num2)
else:
print('Error')
again()
def again():
calc_again = input('''
Wanna Try Again:
if yes please type Y and if no Please Type N
''')
if calc_again.upper() == 'Y':
calculator()
elif calc_again.upper() == 'N':
print('Good Bye')
else:
again()
calculator() #call method
我正在尝试 运行 我在 IDLE 中的代码 Python 我写的一切都是正确的,但遗憾的是我不能 运行。 无故重启。
def calculator():
operation = input('''
Please Enter one of These:
+ for adding
- for minize
* for multiply
/ for devision
''')
num1 = int(input('Num 1 : '))
num2 = int(input('Num 2 : '))
if operation == '+':
print(' {} + {} = ' . format(num1 , num2))
print(num1 + num2)
elif operation == '-':
print(' {} - {} = ' . format(num1 , num2))
print(num1 - num2)
elif operation == '*':
print(' {} * {} = ' . format('num1 , num2'))
print(num1 * num2)
elif operation == '/':
print(' {} / {} = ' . format('num1 , num2'))
print(num1 / num2)
else:
print('Error')
again()
def again():
calc_again = input('''
Wanna Try Again:
if yes please type Y and if no Please Type N
''')
if calc_again.upper() == 'Y':
calculator()
elif calc_again.upper() == 'N':
print('Good Bye')
else:
again()
您必须调用 calculator() 方法来启动程序(检查最后一行)..
def calculator():
operation = input('''
Please Enter one of These:
+ for adding
- for minize
* for multiply
/ for devision
''')
num1 = int(input('Num 1 : '))
num2 = int(input('Num 2 : '))
if operation == '+':
print(' {} + {} = ' . format(num1 , num2))
print(num1 + num2)
elif operation == '-':
print(' {} - {} = ' . format(num1 , num2))
print(num1 - num2)
elif operation == '*':
print(' {} * {} = ' . format('num1 , num2'))
print(num1 * num2)
elif operation == '/':
print(' {} / {} = ' . format('num1 , num2'))
print(num1 / num2)
else:
print('Error')
again()
def again():
calc_again = input('''
Wanna Try Again:
if yes please type Y and if no Please Type N
''')
if calc_again.upper() == 'Y':
calculator()
elif calc_again.upper() == 'N':
print('Good Bye')
else:
again()
calculator() #call method