# Python input and output exercises, arithmetic exercises, turtle preliminary exercises

Source: Internet
Author: User

`1. Hello world!Print("Hello world! ")`
`2. Simple Interactive (interactive, file-style) textbook P19>>> name = input ("pleaseinput your name:")>>> please input Your name:poonprint(name)>>> Poon`
`3, the user input two numbers, calculate and output two numbers of the sum:S1 = float (Input ("Please input the first num:")) S2= Float (Input ("Please input the second num:")) Sum= S1 +S2Print("The result is:%s"%sum)Print("The result is%.2f"% ((Float (input ("The first num is")) + (float (input ("The secibd num is")))))`
` 4, the user input triangle three-side length, and calculate the area of the triangle: (Helen Formula)  A = float (input ( " please input the A side:   " )) b  = float (input ( " please input the B side:   "  = float (input ( " please input the C side:   " )) p  = (A + B + c)/2s  = (p * (p-a) * (p-b) * (P-C)) * * 0.5print  ( " the Square is:%.2f   "% s) `
`5. Enter the radius to calculate the area of the circle.Fromimport= float (input ("pleaseinput the R:"= pi * (r**2 )print("Thearea is%.2f" % s)`
`6, draw a group of same cut roundImport  turtle as Tt.speed (1) t.circle (ten) t.circle (t.circle)(30 )`
` 7, draw a pentagram  import   turtle as Tt.speed (  1)  for  I in  range (5)  T.right ( 144) `
`8. Draw a All-yellow pentagramImport  turtle as Tt.fillcolor ("red") T.begin_fill ()while  True:    t.forward (    t.right) (144)    if abs (POS ()) <1 :          Break T.end_fill ()`

Python input and output exercises, arithmetic exercises, turtle preliminary exercises

Related Keywords:
Related Article

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.