Python Exercise 9-7

Source: Internet
Author: User
Tags goto

Print ('helloworld') Hello World

2

Name = input ( ' Please enter name:')print('%s, hello ') name) Print ('%s classmate, I think can '%name ') Print ('%s, you 're great,%name)

3

1 NUM1 = input (' Please enter first number:')2 Enter the first number: Num2 = input (' Please enter the second number:  ')4 Please enter the second number: sum = float (NUM1) +float (num2)print(float (sum)) 7 11.0

4

Print (' two sum of%.1f' % (float (input (' Enter the first number:') ') +float (input ('  Enter the second number:'))) 2 Enter the first number: 83 Enter the second number: 642 number and 14.0

5

1 A = float (input (")) 2 B = float (input (") ) 3 c = float (input ("))print(' Triangle area is%0.2f ' %area)

6

1 R = 102 Area = 3.1415 * R * rprint(area)print("{:. 2f}" C7>.format (area))5 6 314.150000000000037 314.15

7

Import Turtle2 turtle.pensize (3)3 turtle.circle (Ten)4 turtle.circle (+)5 Turtle.circle (6turtle.circle) 7 turtle.circle (120)

8

Import2 turtle.forward (3 turtle.left (1444 turtle.forward (5 Turtle.left (1446 Turtle.forward (7 turtle.left (1448 Turtle.forward (9 Turtle.left (144)Turtle.forward (100)

9

 from Import * FillColor ("yellow")3 begin_fill () while True:5     forward (6) Right     (144)7     if abs (POS ()) < 1 :8 break         9 End_fill ()

10

 for  in range (4):2     turtle.pu ()3     Turtle.goto (0,-(i+1) *10)4      TURTLE.PD ()5     turtle.circle ((i+1) *10)

11

1ImportTurtle2Turtle.penup ()3 Turtle.goto (-300,300) 4Turtle.pendown ()5 Turtle.color ("Red") 6 Turtle.fillcolor ("Red") 7Turtle.begin_fill ()8 Turtle.forward (500) 9 Turtle.right (90)Ten Turtle.forward (300)Turtle.right (90)Turtle.forward (500)Turtle.right (90)Turtle.forward (300)Turtle.right (90)16Turtle.end_fill ()17Turtle.penup ()Turtle.goto (-250,250)19Turtle.pendown ()Turtle.color ("Yellow")Turtle.fillcolor ("Yellow")22Turtle.begin_fill ()23 forIinchRange (5):Turtle.forward (150)Turtle.right (144)26Turtle.end_fill ()27Turtle.penup ()Turtle.goto (-90,280)29Turtle.pendown ()30Turtle.begin_fill ()31 forIinchRange (5):Turtle.forward (40)Turtle.right (144)34Turtle.end_fill ()35Turtle.penup ()Turtle.goto (-80,230)37Turtle.pendown ()38Turtle.begin_fill ()39 forIinchRange (5):Turtle.forward (40)Turtle.right (144)42Turtle.end_fill ()43Turtle.penup ()Turtle.goto (-90,190)45Turtle.pendown ()46Turtle.begin_fill ()47 forIinchRange (5):Turtle.forward (40)Turtle.right (144)50Turtle.end_fill ()51Turtle.penup ()Turtle.goto (-95,140)53Turtle.pendown ()54Turtle.begin_fill ()55 forIinchRange (5):Turtle.forward (40)Turtle.right (144)Turtle.end_fill ()

Python Exercise 9-7

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.