Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/blog.hsmao.cn/usr/plugins/AMP/Action.php on line 388
20211113笔记

hmao的日记

20211113笔记

第36课

1.random随机数库

import random
#while True:
r=random.randint(0,8568487509)
print(r)

2.程序休眠

import random
import time
while True:
    print(random.randint(0,2981329))
    time.sleep(0.1)

3.飞机大战实战模拟

import random
x=random.randint(0,480-57)
print('坐标为:'+str(x))

4.例子

import random
import easygui
num=random.randint(0,100)
re=101
n=0
while guise !=num:
    re=int(easygui.enterbox("cai"))
    if re>num:
        easygui.msgbox('猜大了')
    if re<num:
        easygui.msgbox('猜小了')
    n+=1
easygui.msgbox('duile'+str(n)+'次')

第37课

1.单词

weapon武器

2.回忆如何定义Hero对象

class Hero():
    def __init__(self,name,gender,weapon):
        self.name=name
        self.gender=gender
        self.weapon=weapon

hero_list=[Hero('关羽','男','青龙~'),Hero('赵云','男','龙胆~'),Hero('吕布','男','方天~')]
print(hero_list[0].name,hero_list[0].gender,hero_list[0].weapon)
print(hero_list[1].name,hero_list[1].gender,hero_list[1].weapon)
print(hero_list[2].name,hero_list[2].gender,hero_list[2].weapon)

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »

因本文不是用Markdown格式的编辑器书写的,转换的页面可能不符合AMP标准。