码迷,mamicode.com
首页 > 编程语言 > 详细

python 2019.10.16

时间:2019-10-15 19:13:45      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:改变   NPU   身高   height   结束   color   %s   占位符   inpu   

学了if语句

if 条件:
    结果

if 条件:
    结果
elif 条件:
    结果
else:
    结果
while循环
while 循环条件:
    循环体

循环终止
1.改变循环条件终止
2.break 终止循环
3.continue 跳过本次循环继续下次循环

while 循环条件:
    循环体
else#循环结束后运行else

占位符 %$:表示字符串  $d表示数字
例:
name = input("请输入你的名字")
age = int(input("请输入你的年龄"))
height = int(input("请输入你的身高"))

info=(我叫%s年龄$d岁身高%dcm学习进度3%%) %(name, age,height)
print(info)

运算符 + — * / % == +=  —= *=  /=  != <>  > < 
逻辑运算符 not  and  or  优先级:()not and or
print(1 or 2) # 1
print(0 or 2) # 2
print(1 and 2)# 2
print(0 and 2)# 0

 

python 2019.10.16

标签:改变   NPU   身高   height   结束   color   %s   占位符   inpu   

原文地址:https://www.cnblogs.com/LMJlmj/p/11679273.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!