Python 入门编程学习01:

python 里的基础输出功能:

print('hello world!')

基本运算:

a = 2
b = 3
c = a * b
print(c)

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

四种数据类型:

a = 1.2
b = 1
c = 'shabi'
d = True

print(type(a))
print(type(b))
print(type(c))
print(type(d))
print(3 < 2)

输入:

a = input('please input a:')
b = input('please input b:')
c = int(input('please input c:'))
d = int(input('please input d:'))
print(a+b)
print(c+d)

 

 求图形的面积:

length = float(input('请输入长方行的长:'))
high = float(input('请输入长方行的高:'))
area = length * high
print('长方形的面积是:',area)

length = float(input('三角形的长:'))
high = float(input('三角平行的高'))
area = length * high / 2
print('三角形的面积是:', area)

三种符号的意义:

a = 10 / 3
b = 10 // 3
c = 10 % 3
print(a,'\n',b,'\n',c,'\n')

判断奇偶性:

a= int(input('请随机输入一个数据:'))
if a % 2 == 0 :
    print('数据是偶数')
else:
    print('数据是奇数')

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值