2016-08-13 83 views
-1

我寫我的第一個代碼,無法弄清楚這個錯誤意味着什麼,我應該修復,請幫助。錯誤:解析時意外的eof錯誤:解析時意外的eof?

import math 

def circumference(r): 
return 2 * math.pi * r 

def area(r) : 
return math.pi * radius**2 * r 

fName = input("Please enter your first name: ") 
lName = input("Please enter your last name: ") 
radius = float(input(fName + " " + lName + " , please enter your radius: ")) 


print("Hello %s %s Your circumference is %s and your area is %s " % (fName, lName, circumference(radius), area(radius)) 
+0

你如何運行你的腳本? – Daniel

+2

你忘記了在末尾 – ailin

+0

的右括號,如果你使用python3,你可以使用'str.format()',[here](https://docs.python.org/3/library/string.html#format例子) – ailin

回答

0

您需要關閉您打開的每個括號。可能導致錯誤的代碼行如下:

print("Hello %s %s Your circumference is %s and your area is %s " % (fName, lName, circumference(radius), area(radius)) 

您在最後缺少「)」。