Python 为什么在这段代码中会出现语法错误?
我的程序不工作,因为它说它有语法错误Python 为什么在这段代码中会出现语法错误?,python,python-3.x,Python,Python 3.x,我的程序不工作,因为它说它有语法错误 answer1 = input("yes or no "); if answer1 == "yes" : { print("Welcome to <<A Random Chance>>") print("Today we will be playing <<Who's Higher>>
answer1 = input("yes or no ");
if answer1 == "yes" :
{
print("Welcome to <<A Random Chance>>")
print("Today we will be playing <<Who's Higher>>")
answer1=输入(“是或否”);
如果回答1==“是”:
{
打印(“欢迎使用”)
print(“今天我们将首先播放python对语句和循环不使用{}
。它使用:
(冒号)和
Secondpython不使用分号。语句以新行结尾。
(如果要将多个语句放在同一行上,可以使用分号分隔语句。)
因此,请尝试以下代码:
answer1 = input("yes or no ")
if answer1 == "yes":
print("Welcome to <<A Random Chance>>")
print("Today we will be playing <<Who's Higher>>")
answer1=输入(“是或否”)
如果回答1==“是”:
打印(“欢迎使用”)
print(“今天我们要玩的Python不使用{}表示代码块。相反,它使用缩进。还要去掉分号。语句以新行结尾。