lesson01

第一节课:基本数据类型 和 引用数据类型的区别:   在内存里面会有栈: 先进后出(存基本数据类型)     堆:如array 存储的 地址 但是array这个地址的值 存在的栈里面的
队列: 先进先出(里面存的地址) 引用数据类型








python 里面  存的是地址  如n = 5  n里面存的就是地址  


type() 类型判断
a = 10
isinstance(a, int)  a 是不是int类型的
 in  在什么什么里面   not in  不在什么什么里面
 is   x is y 
id()
// 作业
请输入成绩:如果大于等于90,输出“优秀”,如果大于等于70,输出“良好”,
 如果大于等于60,输出“及格”,否则输出“不及格”

用户输入月份,判断当前月份为几月,并输出有多少天。如果用户输入2月份,则请用户输入年份,判断平年则输出28天,闰年则输出29天。(能被4整除但不能被100整除,或者能被400整除)

选做题:猜数游戏:随机生成一个1-100的数:让用户猜














import random
# assignment  作业 2018-5-30
"""
1.请输入成绩:如果大于等于90,输出“优秀”,如果大于等于70,输出“良好”,
 如果大于等于60,输出“及格”,否则输出“不及格”

2.用户输入月份,判断当前月份为几月,并输出有多少天。如果用户输入2月份,则请用户输入年份,判断平年则输出28天,闰年则输出29天。
(能被4整除但不能被100整除,或者能被400整除)

3.选做题:猜数游戏:随机生成一个1-100的数:让用户猜
"""
"""
# 1.请输入成绩:如果大于等于90,输出“优秀”,如果大于等于70,输出“良好”
try:
    socore = int(input('请输入你的成绩:'))
    if socore >= 150:
        print('你成绩有那么高吗?')
    elif socore >= 90:
        print(" 你的成绩是优秀:%s" % socore)
    elif socore >= 70:
        print(" 你的成绩是良好:%s" % socore)
    elif socore >= 60:
        print('你的成绩良好:%s' % socore)
    else:
        print('不及格')

except:
    print('你输入的成绩不合法')
"""

"""
# 2.用户输入月份,判断当前月份为几月,并输出有多少天。如果用户输入2月份,则请用户输入年份,判断平年则输出28天,闰年则输出29天。
# (能被4整除但不能被100整除,或者能被400整除)

moth = input('请输入月份:')
moth = int(moth)
if moth <= 12:
    if moth in [1, 3, 5, 7, 8, 10, 12]:
        print('你输入的月份为{0}月,{0}为大月有31天'.format(moth))
    elif moth == 2:
        year = int(input('请输入年份:'))
        if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
            print('你输入的月份为2月%s年的2份有29天' % year)
        else:
            print("你输入的月份为2月%s年的2份有28天" % year)
    else:
        print('你输入的月份为{0}月,{0} 月为小月有30天'.format(moth))
else:
    print('你输入的有误')
"""

"""
# 3.选做题:猜数游戏:随机生成一个1-100的数:让用户猜

number2 = random.randint(1, 100)
while True:
    number3 = int(input('请输入1-100的数:'))
    if number2 > number3:
        print("你输入的数小了")
    elif number3 > number2:
        print('你输入的数大了')
    else:
        print("你赢了")
        exit()

"""

  

猜你喜欢

转载自blog.csdn.net/hai_peng_yu/article/details/80505593
今日推荐