1 打印我的年纪
print("hello,world")
age=18
print("我的年龄是%d岁,我叫%s"%(age,"小白"))
2 条件语句
a=input("请输入a= ")
b=input("请输入b= ")
if a>=b :
print("yes yes yes")
else:
print("no no no")
3 for while循环,不仅可以迭代整数序列,还可以迭代其他对象 如 字符串 列表 元组 字典
for i in [1,2,3,4,5,6]:
print(i)
for i in range(5):
print(i)
for i in range(1,10,2):
print(i)
st="hello world"
for i in st:
print(i)
lb=[6,66,666,"你","好"]
for i in lb:
print(i)
tup=(2,233,"hello")
for i in tup:
print(i)
dict={"name":"小白","age":18}
for i in dict:
print (i,dict[i])
3.1利用循环写出1+2+3......+100
sum=0
i=1
while i<101: