Python second lesson

Source: Internet
Author: User

Import turtleturtle.shape (' Turtle ') turtle.speed (5) turtle.color (' green ') var=1while var = = 1: For      I in range (5):          Turtle.forward (turtle.right)          (144)   

Infinite loop of the pentagram

From Turtle Import*for I in range (5): Up     ()     Goto (0,-20*i) down     ()     Circle (20*i)

Draw concentric circles with loops

Import turtleturtle.shape (' Turtle ') turtle.speed (5) Turtle.color (' Yellow ') turtle.bgcolor (' Red ') turtle.fillcolor (' Yellow ') def my_goto (x, y):    turtle.up ()    Turtle.goto (x, y)    Turtle.down () def MY_STAR5 (R):    Turtle.begin_fill () for    I in range (5):        Turtle.forward (R)        turtle.right (144)        Turtle.end_fill () my_ Goto ( -250,100) MY_STAR5 (+) My_goto ( -150,75) MY_STAR5 (+) My_goto ( -100,50) MY_STAR5 (My_goto) ( -50,25) MY_STAR5 (50) My_goto ( -0,0) MY_STAR5 (50)

Five pentagram with a function

Import Turtledef Draw_diamond (Brad):    Brad.forward (+)    brad.right (GB)    Brad.forward (+)    Brad.right (135) def Draw_art ():    window=turtle. Screen ()    Window.bgcolor ("Pink")    brad=turtle. Turtle ()    brad.shape (' Turtle ')    brad.color (' yellow ')    brad.speed (+) for    I in range (1,37):        Draw_diamond (Brad)        Draw_diamond (Brad)        Brad.left () Draw_art ()

Draw a Flower

R = Input ("Enter school Number:") Print ("School year:", R[:4]) print (R[4:6], ": On behalf of network Engineering") Print ("Study No.:", R[10:12])

Enter student number recognition grade professional serial number

R = input ("Please enter Number:") Print (' Week ', R)

Day of the Week

Python second lesson

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.