创建变量时出现 "Invalid Syntax" 错误

Getting "Invalid Syntax" Error when creating variable

我正在为一项作业创建这个程序。我正在尝试创建一个变量来命名稍后将在代码中打印的新变量。

"""
This program asks the user for three ingredients,
three amounts, and a number of servings, and
determines how much of each ingredient is needed
to serve the specified number of servings.
"""

# Write program here...
print("Welcome to Salad Calculator!")
firstfood = input("What is the first ingredient?: ")
firstounce = float(input("How many ounces of this ingredient do you need?: ")
secounce = input("What is the second ingredient?: ")
secounce = float(input("How many ounces of this ingredient do you need?: ")
thirfood = input("What is the third ingredient?: ")
thirounce = float(input("How many ounces of this ingredient do you need?: ")
servings = int(input("How many servings do you need to make? (Enter a whole number): ")
print(" ")

print("You will need " + str(firstounce * servings) + " ounces of " + firstfood)
print("You will need " + str(secounce * servings) + " ounces of " + secfood)
print("You will need " + str(thirounce * servings) + " ounces of " + thirfood)

当 运行 我得到:

File "main.py", line 12
    secounce = input("What is the second ingredient?: ")
           ^
SyntaxError: invalid syntax

我见过其他人遇到与我类似的问题,但我不确定哪里出了问题。将不胜感激。

firstounce 缺少第二个右括号。以下是固定代码

"""
This program asks the user for three ingredients,
three amounts, and a number of servings, and
determines how much of each ingredient is needed
to serve the specified number of servings.
"""

# Write program here...
print("Welcome to Salad Calculator!")
firstfood = input("What is the first ingredient?: ")
firstounce = float(input("How many ounces of this ingredient do you need?: "))
secfood = input("What is the second ingredient?: ")
secounce = float(input("How many ounces of this ingredient do you need?: "))
thirfood = input("What is the third ingredient?: ")
thirounce = float(input("How many ounces of this ingredient do you need?: "))
servings = int(input("How many servings do you need to make? (Enter a whole number): "))
print(" ")

print("You will need " + str(firstounce * servings) + " ounces of " + firstfood)
print("You will need " + str(secounce * servings) + " ounces of " + secfood)
print("You will need " + str(thirounce * servings) + " ounces of " + thirfood)