Python

时间:2021-05-24 06:38:27   收藏:0   阅读:0

内置函数:

bool()计算对象的bool值

type()查看数据类型

str()转字符

int()转int

float()转浮点

a is b 比较ID是否相等

not b 等于 !b

//取整运算

** 幂运算

“”“xxx""" 块注释,也可以作为字符串使用

None

空列表:[]、list()

空元祖:()、tuple()

空字典:{}、dict()

空集合:set()

逻辑分支:

# coding:utf-8

num=int(input("请输入一个整数"))


if num%2==0:
    print(str(num)+"是偶数")
else:
    print(num,"是奇数")
1 score = int(input("请输入一个成绩"))
2 
3 if 90 <= score <= 100:
4     print("A级")
5 elif 80 <= score <= 89:
6     print("B级")
7 else:
8     print("C级")

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!