上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: 有一个列表[11, 15, 2, 7],有一个目标值为9,求列表里的哪2个数字和是9,打印出他们的下标 点击查看代码 list = [11, 15, 2, 7] target = 9 for i in range(len(list)): for j in range(i + 1, len(list) 阅读全文
posted @ 2024-10-02 08:10 神仙不在 阅读(12) 评论(0) 推荐(0)
摘要: 点击查看代码 # 判断一个整数是否为回文数 num = input('输入一个整数:') dao_num = num[::-1] if dao_num == num: print(f'{num}是回文数') else: print(f'{num}不是回文数') 阅读全文
posted @ 2024-09-29 20:42 神仙不在 阅读(15) 评论(0) 推荐(0)
摘要: 点击查看代码 # 求解 100~999 之间的所有水仙花数 gewei = 0 shiwei = 0 baiwei = 0 for i in range(100, 1000): i = str(i) gewei = int(i[0]) shiwei = int(i[1]) baiwei = int( 阅读全文
posted @ 2024-09-29 16:12 神仙不在 阅读(18) 评论(0) 推荐(0)
摘要: 点击查看代码 for j in range(2, 11): flag = True for i in range(2, j): if j % i == 0: flag = False print(f'{j}是合数,{j}={i}x{j // i}') break if flag: print(f'{ 阅读全文
posted @ 2024-09-28 23:11 神仙不在 阅读(18) 评论(0) 推荐(0)
摘要: 老铁们用 for循环和while循环试试 `` 点击查看代码 for i in range(1, 10): for j in range(9, i - 1, -1): print(f'{j}x{i}={j * i}', end="\t") print() 点击查看代码 i = 1 while i < 阅读全文
posted @ 2024-09-28 12:17 神仙不在 阅读(12) 评论(0) 推荐(0)
摘要: 抛硬币,打印每次的正反面结果,最终统计正反面次数 点击查看代码 import random num = int(input('输入抛硬币的次数')) 正面次数 = 0 反面次数 = 0 for i in range(1, num + 1): random_num = random.randint(1 阅读全文
posted @ 2024-09-27 12:50 神仙不在 阅读(39) 评论(0) 推荐(0)
摘要: 我的python学习笔记,下定决心学一门后端语言 所有视频都在https://www.bilibili.com/video/BV1c4411e77t/, 一个个的记录 今天学习用Python设计第一个游戏 >4p 以下哪个变量命名不正确?为什么? (A)MM_520 (B)MM520 (C)520_ 阅读全文
posted @ 2024-09-25 12:01 神仙不在 阅读(12) 评论(0) 推荐(0)
摘要: 我的python学习笔记,下定决心学一门后端语言 所有视频都在https://www.bilibili.com/video/BV1c4411e77t/, 一个个的记录 今天学习用Python设计第一个游戏 >3p 1.请问下面代码为什么不能正常执行? `` 点击查看代码 """ 用Python设计第 阅读全文
posted @ 2024-09-25 11:18 神仙不在 阅读(14) 评论(0) 推荐(0)
摘要: 点击查看代码 # 接口地址 # https://music.163.com/song/media/outer/url?id= import requests music = input('输入网易云音乐单曲试听地址:') musiclist = music.split('=') # 得到字符串id 阅读全文
posted @ 2024-09-24 07:50 神仙不在 阅读(14) 评论(0) 推荐(0)
摘要: # 网易云音乐的接口链接 music_url = 'https://music.163.com/song/media/outer/url?id=' + music_id 阅读全文
posted @ 2024-09-24 07:28 神仙不在 阅读(332) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页