0
import turtle
    
pen = turtle.Turtle()
pen.speed(10000000000)
pen.color("green", "red")
pen.begin_fill()
     
for i in range(100):
    pen.forward(209)
    pen.left(421)
    pen.right(312)
pen.hideturtle()
turtle.done()
   
o == input("Do you love it?y/n")
  **if o == y:**
      print"Thanks, please love for me{^-^}"
    if o == n:
      print"Thanks for playing{^-^}"
    else:
    
    
      print"I can't understand what are you saying, can you say that again?

链接在这里

在第 16 行语法错误中,我在 trinket 中做到了我的第一个项目我把它放在 trinkets 中在 steamforVietNam 每周挑战

4

2 回答 2

0

正如@Sujay 提到的,你有以下问题:

  • 认同
  • 打印语句语法
  • 分配变量

此外,如果您打算以某种方式使用用户输入(不清楚您想要什么),请将其放在海龟笔上方:

import turtle

o = input("Do you love it?y/n")
if o == "y":
    print("Thanks, please love for me{^-^}")
if o == "n":
    print("Thanks for playing{^-^}")
else:
    print("I can't understand what are you saying, can you say that again?")

pen = turtle.Turtle()
pen.speed(10000000000)
pen.color("green", "red")
pen.begin_fill()
 
for i in range(100):
    pen.forward(209)
    pen.left(421)
    pen.right(312)
pen.hideturtle()
turtle.done()

于 2021-06-21T03:07:55.637 回答
0
  1. ==并且=是不同的。==是为了比较。=是为了分配。

  2. 你用的是python 2.7吗?它应该是 print("I can't understand what are you saying, can you say that again?")

  3. 当您想比较字符串时,请确保使用 ' '" "

import turtle
    
pen = turtle.Turtle()
pen.speed(10000000000)
pen.color("green", "red")
pen.begin_fill()
     
for i in range(100):
    pen.forward(209)
    pen.left(421)
    pen.right(312)
pen.hideturtle()
turtle.done()
   
o = input("Do you love it?y/n")
if o == 'y':
    print("Thanks, please love for me{^-^}")
elif o == 'n':
    print("Thanks for playing{^-^}")
else:
    print("I can't understand what are you saying, can you say that again?")
于 2021-06-21T03:06:02.103 回答