Я снова с большой проблемой, с которой я столкнулся с моим простым проектом Python. По-видимому, это была не просто линия 16. Что-то еще происходит, и я не могу понять это. Ваша мудрость очень ценится. Код проекта ниже:Ошибка синтаксиса прогноза Metric Conversion Python 3
#Request user's name
name = input("Hello! I'm your friendly metric conversion robot. What is your first name? ")
#Miles to Km Conversion
#Request miles & format for float
miles = float(input(name + ", how many miles do you want to convert to kilometers? "))
#Convert miles to kilometers
milesToKm = float(miles * 1.6)
#Display the result
print(name + ", there are " + str(format(milesToKm,'.2f') + " in " + str(miles) + " miles, ")
#Fahrenheit to Celsius Conversion
#Request Fahrenheit temperature
fahre = input(name + ", what is the temperature in Fahrenheit? "))
#Convert Fahrenheit to Celsius
fToC = float((fahre - 32)*(5/9))
#Display result
print(name + ", there are "+ str(format(fToC,'.2f')) + " Celsius in " + str(fahre) + " Fahrenheit degrees.")
#Gallons to Liters Conversion
#Request gallons
gallons = float(input(name + ", how many gallons do you want to convert to liters?"))
#Convert gallons to liters
galToLiters = float(gallons * 3.9)
#Display results
print(name + ", there are " + str(format(galToLiters,'.2f')) + " liters in " + str(gallons) + " gallons.")
#Pounds to Kilograms Conversion
#Request pounds
lbs = float(input(name + ", how many pounds do you want to convert to kilograms?"))
#Convert pounds to kilograms
lbsToKilos = float(lbs *0.45)
#Display results
print(name + ", there are " + str(format(lbsToKilos,'.2f')) + " in " + str(lbs) + " U.S. pounds.")
#Inches to Centimeters Conversion
#Request inches
inches = float(input(name + ", how many inches do you want to convert to centimeters? "))
#Convert inches to centimeters
inchesToCm = float(inches *2.54)
#Display results
print(name + ", there are " + str(format(inchesToCm,'.2f')) + " in " + str(inches) + " inches.")
я получаю то же TraceBack для синтаксической ошибки:
Traceback (most recent call last):
File "/Applications/Komodo IDE 8.app/Contents/SharedSupport/dbgp/bin/py3_dbgp", line 310, in <module>
sys.exit(main(sys.argv))
File "/Applications/Komodo IDE 8.app/Contents/SharedSupport/dbgp/bin/py3_dbgp", line 284, in main
dbgp.client.runWithoutDebug(args, interactive, host, port, idekey, logLevel)
File "/Applications/Komodo IDE 8.app/Contents/SharedSupport/dbgp/python3lib/dbgp/client.py", line 4016, in runWithoutDebug
h_execfile(debug_args[0], debug_args, module=main)
File "/Applications/Komodo IDE 8.app/Contents/SharedSupport/dbgp/python3lib/dbgp/client.py", line 675, in __init__
exec(contents, globals, locals)
File "<string>", line 16
fahre = input(name + ", what is the temperature in Fahrenheit? ")
^
SyntaxError: invalid syntax
Похоже, что на линии над этой линией отсутствует скобка. –