程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python] learning notes week3-1 output input calculation

編輯:Python

【PYTHON】 The calculation of the area of a circle # Input and output numerical calculation

Title Description

Calculate the circle area according to the circle radius , Two decimal places are reserved for the result . among , PI use 3.1415

Input

radius

Output

Area of circle , After decimal point 2 position

The sample input

25

Sample output

1963.44

r=eval(input())
pi=3.1415
print("{:.2f}".format(r*r*pi))

【PYTHON】 Say something in your heart # Input and output

Title Description

Receive two user inputs from the console in two times : The first one is " The person's name ", The second content is " one's innermost thoughts and feelings ".‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‭‬ Then form the two input contents into the following sentence pattern and output :‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‭‬ ( The person's name ), I want to say to you ,( one's innermost thoughts and feelings )

Input

The person's name ‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬ one's innermost thoughts and feelings

Output

( The person's name ), I want to say to you ,( one's innermost thoughts and feelings )

The sample input

Ang Lee You are so talented !

Sample output

Ang Lee , I want to say to you , You are so talented !

a=input()
b=input()
print("{}, I want to say to you ,{}".format(a,b))

【PYTHON】2 Of n Power # Numerical calculation

Title Description

Calculation 2 Of n Power ,n Input by user

Input

Enter a positive integer

Output

Output a positive integer

The sample input

5

Sample output

32

a=eval(input())
print("{}".format(2**a))

【PYTHON】 Enter two numbers from the keyboard , Find the sum of them and output

Title Description

This topic requires reading 2 It's an integer A and B, And then output their sum .

Input

Give an addend in a line Give an addend on another line

Output

Output sum values in one line .

The sample input

18 -48

Sample output

-30

a=eval(input())
b=eval(input())
print("{}".format(a+b))

【PYTHON】 Read in 3 Number , Output their sum and average # Numerical calculation

Title Description

Programming reads... From the keyboard 3 Number , Output their sum and average . among , The average value is retained 2 Decimal place .

Input

Integers 1 Integers 2 Integers 3

Output

and , Average

The sample input

1 2 3

Sample output

6,2.00

a=eval(input())
b=eval(input())
c=eval(input())
print("{},{:.2f}".format((a+b+c),(a+b+c)/3))

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved