Chapter 2 Reading Notes

03 Run supermarket zero checkout behavior ‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫ ‬‪‬

04 Calculate the score difference and average score of the students' grades, ‬‪‬‮‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪ ‬‮‬‫‬‪‬

05 Comparison operators compare the size relationship ‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫ ‬‪‬

06Mobile phone shop discount activity ‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪ ‬

Supplement, create a new file and save a paragraph. 2.6.2

03

money_all=56.75+72.91+88.5+26.37+68.51 #3001
money_all_str=str(money_all)
print("商品总金额:"+money_all_str)
money_real=int(money_all)
money_real_str=str(money_real)
print("实收金额为"+money_real_str)

 

04

python =95 #3001
english =92
c =89
sub =python-c
avg =(python+english+c)/3
print("Python课程和C语言课程的分数之差:"+str(sub)+"分\n")
print("3门课的平均分:"+str(avg)+"分")

 

05

python = 95 #3001
english = 92
c = 89
print("python= "+str(python)+" english= "+str(english)+" c= "+str(c)+"\n")
print("python < english的结果:" + str(python < english))
print("python > english的结果:" + str(python > english))
print("python == english的结果:" + str(python == english))
print("python != english的结果:" + str(python != english))
print("python <= english的结果:" + str(python <= english))
print("python >= c的结果:" + str(python>=c))

 

06

print("\n手机店正在打折,活动进行中......")  #3001
strWeek = input("请输入中文星期(如星期一):")
intTime = int(input("请输入时间中的小时(范围:0~23):"))
# 判断是否满足活动参与条件(使用if条件语句)
if (strWeek == "星期二" and (intTime >= 10 and intTime <=11)) or (strWeek == "星期五" and (intTime >=14 and intTime <=15)):
                print("恭喜您,获得了折扣活动参与资格,快快选购吧!")
else:
    print("对不起,您来晚一步,期待下一次活动......")

 

2.6.2

fp = open(r'D:\mot.txt','a+')
print("命运给与我们的不是失望之酒,而是机会之杯。",file = fp)
fp.close()

 

The experience and experience of the second chapter:

 For the study of Chapter 2, the most touching thing is the use of variables. Compared with the variables of C language, I found that the definition and use of python variables are easier, but when outputting, I feel that C language is more clear and clear. This may be Because I just learned python for a week, I am not used to it. I just learned about "i++;" in C language today, and "i++" is a wrong usage in python. The use of variables in python is quite convenient. There are also sequences to be learned. In python, sequences can be output from right to left. In this chapter, I encountered the "happy number" thing. I didn't know how to solve the situation that it was not a happy number and the output was False, so I read the knowledge of the sequence, and then looked at the set, and it seemed to be solved. This is also considered a preview. Keep working hard tomorrow.

Guess you like

Origin blog.csdn.net/m0_61463713/article/details/120297720