Mever 发表于 2023-3-4 02:11:03

照抄的程序又运行不了,卡在print那 invalid syntex

总在print那行报错 invalid syntex, 我已经不会input 和print语法了{:10_247:}
#求最大公约数
def gcd(p,q):
    while p%q!=0:
      t=p%q
      p=q
      q=t
    return q

a,b=(map(int,input().split())
print(gcd(a,b))

isdkz 发表于 2023-3-4 18:02:34

def gcd(p,q):
    while p%q!=0:
      t=p%q
      p=q
      q=t
    return q

a,b=map(int,input().split())            # 这一行 = 右边多了一个括号
print(gcd(a,b))

sfqxx 发表于 2023-3-4 22:00:56

多了一个括号,请将它删掉
def gcd(p,q):
    while p%q!=0:
      t=p%q
      p=q
      q=t
    return q

a,b=map(int,input().split())            
print(gcd(a,b))

Mever 发表于 2023-3-5 23:47:08

谢谢~ 多谢两位大神 isdkz @sfqxx{:10_288:}
明白了 map前面不用这个 (多了个单括号,现在能行了
页: [1]
查看完整版本: 照抄的程序又运行不了,卡在print那 invalid syntex