python computer experiment 01 fundamentals of python language

[experimental objective] 1) master the installation and use of Anaconda3 development environment.
2) Master the creation and operation mode of Python program, including the direct operation mode of Python program in the development environment and the interactive operation mode in the command prompt environment.
3) Master Python basic input and output functions, code writing specifications and comment statements. 4) Master the import and use of Python standard library and extension library.
5) Understand the usage of pip tool and be able to install new modules, view installed modules, upgrade or uninstall installed modules. 6) Understand and master the of Python program__ name__ Properties.
7) Master the usage of Python operators and common built-in functions. 8) Preliminarily master the concepts and basic usage of list, Yuanzu, dictionary and set.
9) Preliminarily master the usage of lambda expression as function parameter.

(2) The necessary part in the experimental class

1. Input any large natural number and output the sum of each number.

num=input('Please enter a natural number:')

2. Cylinder calculation with two decimal places (value crr11)
Using Python calculation, the results retain two decimal places: the volume and surface area of a cylinder with a bottom radius of 66 and a height of 24.2. Keep 2 decimal places for the result.

pi = 3.1415
r = 66
h = 24.2
v = pi*r*r*h
s = pi*r*r*2+2*pi*r*h
print("The volume is {:.2f}".format(v)) #String object method input two decimal places another '%. 2f'% v
print("Surface zrea is {:.2f}".format(s))

3. Cr18 operation type and grade conversion (three courses)
Xiao Ming takes part in the Chinese, mathematics and English examinations. Input Xiao Ming's three scores and find the sum of the three scores. What are the average, maximum and minimum scores?
If the three courses are included in the total score with weights of 0.5, 0.3 and 0.2, what is Xiaoming's final total score?

Chi = eval(input('chinew scores:'))

Math = eval(input('Maths scores:'))    #eval() converts the string object into a valid expression to participate in the evaluation operation and return the calculation result

English = eval(input('English scores:'))

print('sum score all',Chi+Math+English)

print('Average {:.2f}'.format((Chi+Math+English)/3))

print('highest ',max(Chi,Math,English))

print('lowest ',min(Chi,Math,English))


4. Change (value crr41)
The store needs to give change to customers. Now there are only a few pieces of RMB 50 yuan, 5 yuan and 1 yuan. Enter an integer value and give the change scheme. It is assumed that there are enough RMB and coins with large denomination are preferred.

money = eval(input(" "))
m50 = money//50 # calculate the number of 50
money = money%50 #Mod 
m5 = money//5 # / returns floating-point results, while / / returns integer results(

print("The number of 50 yuan denomination notes is:",m50)
print("The number of 5 yuan denomination notes is:",m5)
print("The number of 1 yuan denomination notes is:",m1)

5. Binary conversion program, input a natural number and output its binary, octal and hexadecimal representations. (3500)

num = int(input('Please enter a natural number:'))
print('octal number system:',oct(num))

Posted by spxmgb on Thu, 12 May 2022 10:47:06 +0300