be toraw_input()如果您使用的是Python 2.7,您需要:在if、elif和else的行尾。谢谢,虽然我仍然无法从控制台运行它,但它现在似乎正在工作,我想我需要对它进行更多的故障排除。您使用的是什么操作系统,您使用什么命令来运行它?当您输
be toraw_input()如果您使用的是Python 2.7,您需要:在if、elif和else的行尾。谢谢,虽然我仍然无法从控制台运行它,但它现在似乎正在工作,我想我需要对它进行更多的故障排除。您使用的是什么操作系统,您使用什么命令来运行它?当您输,python,python-2.7,Python,Python 2.7,be toraw_input()如果您使用的是Python 2.7,您需要:在if、elif和else的行尾。谢谢,虽然我仍然无法从控制台运行它,但它现在似乎正在工作,我想我需要对它进行更多的故障排除。您使用的是什么操作系统,您使用什么命令来运行它?当您输入命令时,控制台会说什么?我在win 7上,当我在命令行上时,我可以通过键入C:\python27\python exe让python运行,但是如果我只是键入python,它将不会运行,并给我一个未定义的错误。当您运行C:\python27\p
be to
raw_input()
如果您使用的是Python 2.7,您需要:
在if
、elif
和else
的行尾。谢谢,虽然我仍然无法从控制台运行它,但它现在似乎正在工作,我想我需要对它进行更多的故障排除。您使用的是什么操作系统,您使用什么命令来运行它?当您输入命令时,控制台会说什么?我在win 7上,当我在命令行上时,我可以通过键入C:\python27\python exe让python运行,但是如果我只是键入python,它将不会运行,并给我一个未定义的错误。当您运行C:\python27\python.exe myprogram.py
(myprogram.py是您的程序吗)?您可以通过获取python
命令,我将在稍后有更多时间查看该链接。感谢您的帮助Oleg。感谢您的反馈,看起来我遇到的问题比我最初意识到的要多,但它现在正在工作!
print ('Lets do some math nerd!')
print ('How many problems would you like to solve?')
cycle = int(input())
rep = 0
while cycle < rep;
rep = rep + 1;
print ('What operation would you like to perform?')
print('Press 1 for Addition')
print('Press 2 for Subtraction')
print('Press 3 for Multiplication')
print('Press 4 for Division')
op = int(input())
if op ==1
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 + num2)
print result
elif op ==2
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 - num2)
print result
elif op ==3
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 * num2)
print result
elif op ==4
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 / num2)
print result
else
print ('ERROR')
print (Please select a number 1 through 4.')
print ('Thanks for using my calculator!')
closeInput = raw_input("Press ENTER to exit")
print "Closing..."
#!/usr/bin/python
print ('Lets do some math nerd!')
print ('How many problems would you like to solve?')
cycle = int(input())
rep = 0
while rep < cycle:
rep = rep + 1
print ('What operation would you like to perform?')
print('Press 1 for Addition')
print('Press 2 for Subtraction')
print('Press 3 for Multiplication')
print('Press 4 for Division')
op = int(input())
if op ==1:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 + num2)
print result
elif op ==2:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 - num2)
print result
elif op ==3:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 * num2)
print result
elif op ==4:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 / num2)
print result
else:
print ('ERROR')
print ('Please select a number 1 through 4.')
print ('Thanks for using my calculator!')
closeInput = raw_input("Press ENTER to exit")
print "Closing..."
import pdb
print ('Lets do some math nerd!')
print ('How many problems would you like to solve?')
cycle = int(input())
rep = 0
while cycle < rep:
rep = rep + 1
print ('What operation would you like to perform?')
print('Press 1 for Addition')
print('Press 2 for Subtraction')
print('Press 3 for Multiplication')
print('Press 4 for Division')
op = int(input())
if op ==1:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 + num2)
print result
elif op ==2:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 - num2)
print result
elif op ==3:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 * num2)
print result
elif op ==4:
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 / num2)
print result
else:
print ('ERROR')
print ('Please select a number 1 through 4.')
print ('Thanks for using my calculator!')
closeInput = raw_input("Press ENTER to exit")
print "Closing..."