Python Case 1

Source: Internet
Author: User

‘‘‘
1. Write the program, get a person's information from the keyboard, and then display the ================================== in the following format???
Name:? Dongge????? ????
Qq:xxxxxxx?????
Phone number: 131xxxxxx???
? Company address: Beijing xxxx?
‘‘‘
Name=input ("Please enter Name:")
Qq=input ("Input QQ:")
Cell=input ("Please enter phone number:")
Address=input ("Please enter Address:")
Print ("=" 25)
Print ("Name:%s"%name)
Print ("qq:%s"%QQ)
Print ("Phone number:%s"%cell)
Print ("Address:%s"%address)
Print ("="
25)

‘‘‘
2. Enter the length and width of a square to calculate and print its area
‘‘‘
Length=float (Input ("Please enter the length of the rectangle:"))
Wide=float (Input ("Please enter the width of the rectangle:"))
Area=length*wide
Print ("Rectangular area =%f:"%area)

‘‘‘
2. Enter the length and width of a square to calculate and print its area
‘‘‘
Import Math
Radius=float (Input ("radius of circle ="))
Area=math.pi*radius**2
Print ("Circle area =%f"%area)

‘‘‘
Data:
Principal
Annual interest rate
Instructions:
Enter Principal
r1=4.1% r2=3.59% r3=2.28%
Output Principal and
‘‘‘
Num=int (Input ("Please enter the amount to deposit:"))
r1=4.1/100
r2=3.59/100
r3=2.28/100
S1=num+numR1
S2=num+num
R2
S3=num+num*r3
Print ("%.2f\n%.2f\n%.2f\n"% (S1,S2,S3))

‘‘‘
Data:
Area S
Unit Price U
Mortgage ratio m
Commercial loan Interest Rate C
Repayment Life T
Monthly Supply ms
Down Payment p
Instructions:
Enter S, u, M, C, t
Down payment = Area Unit Price mortgage ratio
Monthly supply = Area Unit Price (1-mortgage ratio)(1+)/Repayment life/1
Output P, MS
‘‘‘
S=float (Input ("area:"))
U=float (Input ("unit Price:"))
M=float (Input ("mortgage ratio:"))
C=float (Input ("commercial loan interest Rate:"))
T=float (Input ("Payback period:"))
P=s
um
Ms=s
u(1-m)(1+c)/T/12
Print ("Down Payment:%s\n Month:%s"% (P,MS))

Python Case 1

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.