带有Python示例的True关键字
PythonTrue关键字
True是python中的关键字(区分大小写),它是一个布尔值(类类型bool的值)。比较操作的结果为True。
True关键字的语法
True
示例
Input:
x = True
# 打印 print(x)
Output:
TrueTrue关键字的Python示例
示例1:将True分配给变量,打印True的值和打印类型。
# python程序演示示例
# True 关键词
# 将True分配给变量
x = True
# 打印ing the value
print("x: ", x)
# 打印ing type of True
print("Type of True:", type(True))输出结果
x: True Type of True: <class 'bool'>
示例2:打印一些比较操作的结果。
# python程序演示示例 # 真关键词 a = 10 b = 20 print(a>=10 and b>=20) print(a==10 and b==20) print(a!=20 and b!=10) print(a>5 and b>10)
输出结果
True True True True
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短