摘要: n=int(input()) num=[int(x) for x in input().split()] for i in range(n): print(" ".join(map(str,num))) t=num[-1] num.pop() num.insert(0,t) 阅读全文
posted @ 2022-05-29 22:13 kingwzun 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 莫名其妙 输入时input().split()错误 改为 t= [int(x) for x in input().split()]正确 a,b=map(int,input().split()) num=[] for i in range(a): t= [int(x) for x in input() 阅读全文
posted @ 2022-05-29 22:07 kingwzun 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 知识点 sort函数的参数 (reverse=True) 代码 n=int(input()) num=[] for i in range(n): a,b,c=map(int,input().split()) t=a+b+c num.append(t) num.sort(reverse=True) f 阅读全文
posted @ 2022-05-29 21:55 kingwzun 阅读(142) 评论(0) 推荐(0) 编辑
摘要: li=eval(input()) ans=[] for i in li: if i not in ans: ans.append(i) print(' '.join(list(map(str,ans))))#list转为str 阅读全文
posted @ 2022-05-29 21:49 kingwzun 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 题不难,感觉实现的比较巧妙,记录一下 n=int(input()) cnt=[] for i in range(n+1): cnt.append(chr(65+i)) # print(cnt) for i in range(1,n+1): print("".join(cnt[:i])) 阅读全文
posted @ 2022-05-29 11:24 kingwzun 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 基础 python没有double python中的float和其他语言的double精度一样,直接使用float代替即可。 输入 使用input输入,需要注意的是输入的内容如果不强制转化数据类型,默认都是字符串。 一行输入两个用空格隔开变量 内置函数map用于将指定序列中的所有元素作为参数调用指定 阅读全文
posted @ 2022-05-29 11:19 kingwzun 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 好像是个约瑟夫环, 编程能力确实提高了,随便一想就写出来了..... 要是之前还要搜板子 a=int(input()) sta=list(range(1,a+1)) # print(sta) k=1 indx=0 while len(sta)>1: k+=1 indx=(indx+1)%len(st 阅读全文
posted @ 2022-05-29 10:07 kingwzun 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 题意: 题意是说: 比较两个字符串的是否具有相同的字符。 (空格也算字符) 水题代码:水水水更健康 测试样例太水了。。。。。 直接比较长度就能过 a=input() b=input() if len(a)==len(b): print("yes") else : print("no") 正常解题1: 阅读全文
posted @ 2022-05-29 09:59 kingwzun 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 知识点: 逆序遍历range:只需要[::-1]即可 (从头到尾切片,步长设置为-1) 代码 s=input() a,b=input().split() for i in range(len(s))[::-1]: if s[i]==a or s[i]==b: print("{} {}".format 阅读全文
posted @ 2022-05-29 09:24 kingwzun 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 方法一:使用list judge = [] for i in range(26): judge.append( chr(65+25-i) ) # print(judge) n= input() n= [judge[ord(i)-65] if 'A'<=i<='Z' else i for i in n 阅读全文
posted @ 2022-05-29 09:18 kingwzun 阅读(135) 评论(0) 推荐(0) 编辑