画五角星:
setup(700,400,0,0) >>> bgcolor("red") >>> hideturtle() SyntaxError: unexpected indent >>> hideturtle() >>> up() >>> def move(x): begin_fill() for i in range(5): forward(x) right(144) end_fill() >>> goto(-300,100) >>> fillcolor("yellow") >>> move(100) >>> goto(-145,140) >>> move(30) >>> goto(-65,90) >>> move(30) >>> goto(-65,20) >>> move(30) >>> goto(-145,-40) >>> move(30) >>>
取得校园新闻的编号:
>>> a = "http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html" >>> a=a.rstrip(".html") >>> a=a[-9:] >>> print(a) 1027/8443 >>>
产生python文档的网址
>>> def strCat(html,x): b=html[0:34] c=html[-5:] d=b+x+c print(d) >>> strCat("https://docs.python.org/3/library/turtle.html","intro")
产生校园新闻的一系列新闻页网址:
>>> a = "http://news.gzcc.cn/html/xiaoyuanxinwen/4.html" >>> b=a[0:40] >>> c=a[-5:] >>> for i in range(5): d="" d=b+str(i) d=d+c print(d)