python基础 day3

1,上周五内容回顾。     格式化输出             %s  %d             %%     编码:         ascii 只能显示英文,特殊字符,数字。            万国码:unicode 最开始16位,中文不够32位 4个字节。                    占用资源多。            升级:utf-8 utf-16 utf-32            utf-8:最少用一个字节,8位表示一个英文。                    欧洲16位,两个字节。                    亚洲 24位,三个字节。            gbk:中国国产,只能用于中文和ascii码中的文字。

2,作业讲解。     ....

什么数据类型。     int 1,2,3用于计算。     bool:True,False,用户判断。     str:存储少量数据,进行操作     'fjdsal' '二哥','`13243','fdshklj'     '战三,李四,王二麻子。。。。'     list:储存大量的数据。         [1,2,3,'泰哥','12353234',[1,2,3]]     元祖:只读。         (1,2,3,'第三方',)     dict:字典{'name':'云姐','age':16}            字典{'云姐':[],'二哥':[200,200,200,。。。。。。]}    集合:{1,2,34,'asdf'} 3,int。     4,bool。 5,str。

求1-2+3.....-99的和,88除外
# summ= 0
# count = 1
# while count<100:
#     if count==88:
#         count+=1
#         continue
#     elif count % 2 != 0:
#         summ += count
#     else:
#         summ -=count
#     count+=1
# print(sum)
i=0
name="张三"
pwd=123456
while i<3:
    username=input("请输入你的账号:")
    password=int(input("请输入你的密码:"))
    if username==name and password==pwd:
        print("登陆成功!")
        break
    else:
        print("输入错误,您还有%d次输入机会!" %(2-i))
    i+=1


 
View Code

猜你喜欢

转载自www.cnblogs.com/Forget-the-sky/p/10486879.html