-
-
Save prodevo/900b5728499fb607fce3d84fd5aa8dc1 to your computer and use it in GitHub Desktop.
lists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [1, 2, 3, 4, 5] | |
b = [] | |
for i in range(1, 6): | |
b.append(a[-i]) | |
print(b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import * | |
a = [] | |
b = [] | |
for i in range(20): | |
r = randint(0, 100) | |
a.append(r) | |
if r % 2 == 0: | |
b.append(r) | |
print(a, '\n', b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import * | |
a = int(input('vvedit chyslo vid 0 do 100: ')) | |
c = [] | |
b = [] | |
for i in range(100): | |
r = randint(0, 100) | |
c.append(r) | |
if r == a: | |
b.append(r) | |
print(f'chyslo zustrichaetsa {len(b)} raz(iv)') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import * | |
a = [] | |
one = 0 | |
two = 0 | |
three = 0 | |
for i in range(200): | |
r = randint(0, 200) | |
a.append(r) | |
if r >= 0 and r <= 9: | |
one += 1 | |
elif r >= 10 and r <= 99: | |
two += 1 | |
elif r >= 100 and r <= 999: | |
three += 1 | |
one = one / 2 | |
two = two / 2 | |
three = three / 2 | |
print('one_digit', one / 2) | |
print('one_digit', two / 2) | |
print('one_digit', three / 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import * | |
m = [] | |
n = [] | |
a = [] | |
for i in range(randint(0, 500)): | |
m.append(randint(0, 20)) | |
for i in range(randint(0, 500)): | |
n.append(randint(0, 20)) | |
if len(m) >= len(n): | |
for i in range(len(n)): | |
if n[i] == m[0]: | |
a.append(n[i]) | |
del m[0] | |
else: | |
for i in range(len(m)): | |
if m[i] == n[0]: | |
a.append(m[i]) | |
del n[0] | |
print(set(a)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roman = [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"),(100, "C"), (90, "XC"), (50, "L"), (40, "XL"),(10, "X"), (9, "IX"), (5, "V"), (4, "IV"),(1, "I")] | |
a = [] | |
for i in range(1, 4000): | |
result = '' | |
t = i | |
for val, num in roman: | |
while t >= val: | |
result += num | |
t -= val | |
a.append(result) | |
for num in a: | |
print(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment