热门

最新

红包

立Flag

投票

同城

我的

发布
mali1914010133
M1914010133
3 年前
truemali1914010133

Python基础语法 PTA
7-1 Life is short, I want to learn python (高教社,《Python编程基础及应用》:
m='Life is short,I want to learn python!'
print(m)

7-2 输出 Hello World ! :
print('Hello World !')


7-4 你是大学生了:
name = input("请输入你的姓名:")
print(name + ',你已经是一名大学生了!')


7-6 2的n次方:
n = int(input())
e=2**n
print(e)


7-7 重复多个星号:
n = int(input())
x = 0
for x in range(n):
print('*',end='')

7-3 交换两个整数:
a, b = input().split()
#b = int(input())
#input()
c=a
a=b
b=c

print('a='+ a, 'b='+b)

7-5 计算两个整数的差:
a,b=input().split(' ')
c=int(a)-int(b)
print("s="+str(c))


7-8 表达式求值:
a=5
b=8
c=3

e=b**2
rootprt = e-4*a*c
r = (rootprt)**(1/2)
x=(b*(-1)+r)/(2*a)

print(x)

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
1
立即登录