0
点赞
收藏
分享

微信扫一扫

HTML实现弹出层

全栈学习笔记 2024-08-12 阅读 29
python

1. 求一个数的幂值

def mi(a, b):
    c = a
    for i in range(b-1):
        a = a * c
    return a


print(mi(2, 4))

2. 输出斐波那契数列

def feibonaqi(n):
    l = []
    a = 1
    b = 1
    for i in range(n):
        l.append(a)
        l.append(b)
        a = b + a
        b = a + b
    print(l)


feibonaqi(5)

3. 输出特定字典数据

keys = ['name', 'old', 'score']
values = [
    ['yee', 3, 99], ['rose', 18, 8], ['green', 30, 90]
]
要输出结果:
[{'name': 'yee', 'old': 3, 'score': 99}, {'name': 'rose', 'old': 18, 'score': 8}, {'name': 'green', 'old': 30, 'score': 90}]
举报

相关推荐

0 条评论