上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 50 下一页
摘要: 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 阅读(52) 评论(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 阅读(140) 评论(0) 推荐(0)
摘要: 基础 python没有double python中的float和其他语言的double精度一样,直接使用float代替即可。 输入 使用input输入,需要注意的是输入的内容如果不强制转化数据类型,默认都是字符串。 一行输入两个用空格隔开变量 内置函数map用于将指定序列中的所有元素作为参数调用指定 阅读全文
posted @ 2022-05-29 11:19 kingwzun 阅读(108) 评论(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 阅读(66) 评论(0) 推荐(0)
摘要: 题意: 题意是说: 比较两个字符串的是否具有相同的字符。 (空格也算字符) 水题代码:水水水更健康 测试样例太水了。。。。。 直接比较长度就能过 a=input() b=input() if len(a)==len(b): print("yes") else : print("no") 正常解题1: 阅读全文
posted @ 2022-05-29 09:59 kingwzun 阅读(78) 评论(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 阅读(67) 评论(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 阅读(218) 评论(0) 推荐(0)
摘要: 知识点 数据类型转化 代码 n=list(input())#string转list print(len(n),end= " ") n= map(int,n)#将list里面的元素转为int类型 ans=0 for i in n: ans+=i print(ans) 阅读全文
posted @ 2022-05-28 17:23 kingwzun 阅读(197) 评论(0) 推荐(0)
摘要: 做法1:使用re.findall import re n=int(input()) k=input() cnt=format(n,"x") t=re.findall(k,cnt) print(len(t)) 做法2:朴素做法 n=int(input()) k=input() cnt=format(n 阅读全文
posted @ 2022-05-28 16:16 kingwzun 阅读(71) 评论(0) 推荐(0)
摘要: 知识点: re正则表达式的使用‘ list转string string转数字 进制转化 代码: import re str=input() match = re.findall('[0-9a-fA-F]', str) str=''.join(match) str=str.lower() ans10= 阅读全文
posted @ 2022-05-28 11:40 kingwzun 阅读(86) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 50 下一页