If statement IF命令中的语法错误

If statement IF命令中的语法错误,if-statement,syntax,If Statement,Syntax,当我尝试定义rate变量时,总是会出现语法错误。有什么想法吗?如果要求在条件末尾加一个冒号: 如果货币==‘美元’: 速率=1.52您使用此 print ('Here are the availible currency choices for today:') currencylist = ['US Dollar','Kenyan Shilling','Brazilian Real','Canadian Dollar','Indian Rupee','Philippine Peso','

当我尝试定义
rate
变量时,总是会出现语法错误。有什么想法吗?

如果
要求在条件末尾加一个冒号:

如果货币==‘美元’:
速率=1.52

您使用此

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

这是什么语言?python您应该在帖子中添加特定于语言的标记。看起来您的
if
语句结尾缺少了一个
。欢迎使用StackOverflow。假设这是Python,请在您的帖子中添加一个
Python
标记,这样它就能吸引合适的人,并且我们可以确定您使用的是什么语言。此外,在将来,始终发布错误消息。但我敢打赌这只是缺少的冒号。如果是这种情况,请在评论中告知我们。然后使用克隆:
if (currency == 'US Dollar')  {

    rate= 1.52  
    print rate
}