自学Python笔记 Day 13: Lesson 36 ~ Lesson 38

Day 13

Lesson 36

(因个人想象力比较丰富 也加上)学这么多课了 正好就此机会写一个小程序吧~ 我这次打算每天写一点 尽量写一个完整的 我想的是每天写一个函数 并把未来需要的函数命名出来 今日份~

import sys


def forest(heart):
    print("You wake up and you find yourself in a dark dark forest.")
    print("You have two choices, 1. walk forward and try to find a road 2. try to find a flashlight")
    print("Please type 1 or 2:")
    c = input()
    if c == '1':
        print("You can't see anything and you tripped on a tree and you hurt yourself, heart-1")
        heart -= 1
        if heart == 0:
            print("You have ran out of heart, too bad! Game over.")
            sys.exit()
        else:
            print("Be careful! You only have %d heart left!" % heart)

    if c == '2':
        print("You knee down and try to see if there's anything on the ground, and, there's a flashlight!")
        print("You turn on the flashlight and see there's a little house in front")
        print("Will you knock on the door? 1. Yes 2. No")
        c = input()
        if c=='1':
            house(heart)
        else:
            walk(heart)


def house(heart):



def walk(heart):


Lesson 37

这课我就不多说了 这个… 就只能背了 需要更多文档也可以去官网找~

Lesson 38

嗯… 这本书讲得比较慢 当然 不是坏事 练习比较多…
但是 既然有这个练习机会 我就也建议大家不要一模一样的copy书上的内容 尽量自己写

ten = "Dog Cat Fish Chip Chocolate Cake"

print ("Wait there are not 10 things in that list. Let's fix that.")

stuff = ten.split(' ')
more = ["Bed", "Table", "Chair", "Light", "Wall", "Laptop", "Pencil", "TV"]

while len(stuff) != 10:
    next = more.pop()
    print("Adding: ", next)
    stuff.append(next)
    print("There are %d items now." % len(stuff))

print("There we go: ", stuff)

print("Let's do some things with stuff.")

print(stuff[1])
print(stuff[-1])
print(stuff.pop())
print(' '.join(stuff))
print('#'.join(stuff[3:5]))

好啦 今天三课打卡完成~
Au revoir~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值