摘要:
l = [] while True: s = input() if s == '0': #注意:这里是对0加引号,而不是使用int(s),如果输入'hello',int(s)会报错,所以是用字符串'0' break else: l.append(s) print(" ".join(l)) 阅读全文
posted @ 2023-08-13 23:28
limalove
阅读(12)
评论(0)
推荐(0)
摘要:
s = input() print(s.isalpha()) print(s.isdigit()) print(s.isspace()) 阅读全文
posted @ 2023-08-13 23:03
limalove
阅读(102)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2023-08-13 21:02
limalove
阅读(35)
评论(0)
推荐(0)
摘要:
d = { } for i in input(): d[i] = d.get(i, 0) + 1 print(d) 阅读全文
posted @ 2023-08-13 20:28
limalove
阅读(42)
评论(0)
推荐(0)
摘要:
1 d = {'a': ['apple', 'abandon', 'ant'], 'b': ['banana', 'bee', 'become'], 'c': ['cat', 'come'], 'd': 'down'} 2 3 str = input() 4 5 for i in d[str]: 6 阅读全文
posted @ 2023-08-13 20:12
limalove
阅读(29)
评论(0)
推荐(0)
摘要:
cities_dict ={'Beijing':'China', 'Paris':'France', 'Moscow':'Russia'} print('原始列表的key顺序:',cities_dict) print("不对键排序时输出的city顺序:") for city in cities_di 阅读全文
posted @ 2023-08-13 20:04
limalove
阅读(15)
评论(0)
推荐(0)
摘要:
a = {'city':'beijing', 'id':1} b = {'city':'shanghai', 'id':2 } c = {'city':'guanghzou', 'id':3} d = [] d.append(a) d.append(b) d.append(c) for i in d 阅读全文
posted @ 2023-08-13 20:01
limalove
阅读(7)
评论(0)
推荐(0)
摘要:
1 #方法一:这是最先想到的 2 s = [[1,2,3], [4,5,6], [7,8,9]] 3 n = int(input()) 4 5 r = [] 6 for i in s: 7 a = [] #这个很重要,每次要清空 8 for j in i: 9 a.append(j * n) 10 阅读全文
posted @ 2023-08-13 19:11
limalove
阅读(38)
评论(0)
推荐(0)
摘要:
1 #自己的方法 2 num = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] 3 4 x = int(input()) 5 for i in num: 6 if x == i : 7 break 8 else: 9 print(i) 10 11 12 13 14 1 阅读全文
posted @ 2023-08-13 18:41
limalove
阅读(30)
评论(0)
推荐(0)

浙公网安备 33010602011771号