大学python入门

it2024-01-14  62

python第一节课

零智商学编程 /手动狗头

失踪人口回归

print 输出 任意类型 input 输入 一个字符串 eval 将input进的字符串转成字符串内容相应的类型 import 引入第三方函数库 运算符 + - * / //(整除) % (整除非常有意思 多重赋值 a=1 b=2 --> a,b=1,2

#By AcerMo #0 IQ to code ''' print('Hello World!') print(1 + 1) print(2.2 ** 2 - 3.14 * (2.2/2) ** 2) print(3000-0.5*9.8*3.5**2) import math import matplotlib.pyplot as plt #引用函数库 v0 = 200 h = 3000 g = 9.8 mt = math.sqrt(2 * h / g) #调用函数库 print('时间t的范围是0~' , mt) t = eval(input('时间t=')) xt = v0 * t yt = h - 0.5 * g * t ** 2 print(xt ,yt) name = input('你的姓名:') print('你的姓名:',name) age = eval(input('你的年龄:')) #将字符串转成整数 print('出生年份:',2020 - age) '''
最新回复(0)