Day_2 · 变量与数据类型 #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
今日知识点
名字 = 值就能存数据,比如name = "张三"int整数、float小数、str字符串(带引号)、bool布尔(True/False)type(变量)可以查看类型;input("提示")可以让用户从键盘输入(输入的一定是字符串)先学(教程)
任务(后做)
day2.py,写以下代码并运行,先猜输出,再对答案:input()写一个打招呼程序:input()输入的是字符串,试试age = input("几岁?")后运行print(age + 1),观察报错,再用int(age) + 1修复它。完成标准
提交方式:把
day2.py的代码贴在当日工单评论里。参考解答(先做再看)
2
1
作业
喵
2
。
王若琪
2
day2任务完成
1
1
day2
`name="张三"
age=int(18)
score=88.5
is_student=True
print(name)
print(type(name),type(age),type(score),type(is_student))
your_name=input("请输入你的名字:")
print("您好,"+your_name+"!")
age=input("几岁?")
age=int(age)
print(age+1)`
.
1
Day_2 · 变量与数据类型(type() 四种类型 + input 打招呼)