Record the first day of learning python

1. splicing string
"+" sign can be regarded as string concatenation

Shown as: (INPUT ( "message")) Meaning: receiving a string
在这里插入代码片name=input("请输入你的名字") a="我喜欢六月份" b=",六月份是好季节" c="很棒的夏天" print(name+a+b+c)Here Insert Picture Description
2 to enter a number, and if the count is greater than 60, if the print, the pass

num=int(input("请输入一个数字"))
#使用isdigit()方法判断输入的是否为数字,然后才满足判断条件,再去判断,但是注意它返回的是一个字符串,需要修改类型
if 100>=num>=60:
    print("恭喜及格")
elif  0<=num<60:
    print("不及格")
else:
    print("成绩输入有误会")

Note that this returns a string of input type, not int
can not be compared when judged
all first conversion types

Published an original article · won praise 0 · Views 43

Guess you like

Origin blog.csdn.net/qq_42571562/article/details/104533726