Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1
- n = int(input())
- a = [0]
- for i in range(n):
- x = int(input())
- a = [i] * x
- print(a)
- answer: [2, 2, 2]
- #2
- n = int(input())
- a = []
- for i in range(n):
- a = a + [i] * i
- print(a)
- answer: [1, 2, 2]
- #3
- n = int(input())
- a = []
- for i in range(n):
- x = int(input())
- a = a + [x]
- k = sum(a)
- m = len(a)
- print(k/m)
- answer: 4.2
- #4
- n = int(input())
- m = int(input())
- a = []
- for i in range(n):
- x = int(input())
- a += [x]
- print(a[m])
- answer: 32
- #5
- n = int(input())
- a = []
- b = []
- for i in range(n):
- x = int(input())
- a += [x]
- for i in range(len(a)):
- if i % 2 == 0:
- b.append(a[i])
- print(a)
- print(b)
- answer: [1, 2, 3]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement