【发布时间】:2018-05-08 19:41:28
【问题描述】:
print ('Here are the availible currency choices for today:')
currencylist = ['US Dollar','Kenyan Shilling','Brazilian Real','Canadian
Dollar','Indian Rupee','Philippine Peso','Indonesian Rupiah']
print(*currencylist, sep='\n')
currency= input(str('Which currency would you like to choose? '))
pound= input(float('Please enter the amount you would like to exchange. £')
if currency == ('US Dollar')
rate= 1.52
print rate
当我尝试定义 rate 变量时,我不断收到语法错误。有什么想法吗?
【问题讨论】:
-
这是什么语言? Python?您应该在帖子中添加特定于语言的标签。您的
if语句末尾似乎缺少:。 -
欢迎来到 StackOverflow。假设这是 Python,请在您的帖子中添加
python标签,以便吸引合适的人,我们确定您使用的是什么语言。此外,将来,请始终发布错误消息。但我敢打赌,这只是缺少的冒号。如果是这种情况,请在评论中告诉我们。
标签: if-statement syntax