7.31 课后作业
使用格式化输出的三种方式实现以下输出
name = 'Nick'
height = 180
weight = 140
# "My name is 'Nick', my height is 180, my weight is 140"
name = '汪智慧'
height = 185
weight = 110
print('My name is %s , my height is %s,my weight is %s' %(name,str(height),str(weight)))
print("My name is {}, my height is {}, my weight is {}" .format(name,height,weight))
print(f'My name is {name}, my height is {height}, my weight is {weight}')
输入姑娘的年龄后,进行以下判断:
如果姑娘小于18岁,打印“不接受未成年”如果姑娘大于18岁小于25岁,打印“心动表白”如果姑娘大于25岁小于45岁,打印“阿姨好”如果姑娘大于45岁,打印“奶奶好”
age = 22
if age < 18:
print('不接受未成年')
if age > 18 and age<25:
print('心动表白')
if age > 25 and age<45:
print('阿姨好')
if age > 45:
print('奶奶好')
预习while循环,打印1-100之间的偶数:
count = 0
while count<=100:
count += 1
if count%2 == 0:
print(count)
预习while循环,猜年龄游戏升级版,有以下三点要求:
https://www.cnblogs.com/dadazunzhe/p/11265715.html
https://www.cnblogs.com/dadazunzhe/
转载于:https://www.cnblogs.com/dadazunzhe/p/11277460.html
相关资源:你必须知道的495个C语言问题