additions to positional and keyword args
This commit is contained in:
parent
3def940775
commit
9016442dda
46
docs/python/test.py
Normal file
46
docs/python/test.py
Normal file
@ -0,0 +1,46 @@
|
||||
# # i номер строки
|
||||
# # j номер столбца
|
||||
|
||||
# n = int(input())
|
||||
# a = [[0 for j in range (n)] for i in range (n)]
|
||||
# #выше сделала квадратную матрицу с сторонами n заполненную нулями
|
||||
# for num in range(1,(n**2)+1):
|
||||
# for i in range(n):
|
||||
# for j in range(n):
|
||||
# print (a)
|
||||
|
||||
|
||||
# lst = (int(i) for i in input().split())
|
||||
# l = [1,2,3,4,5]
|
||||
# def modify_list(l):
|
||||
# # i = int(i)
|
||||
# for i in reversed(range(len(l))):
|
||||
# if i % 2 !=0:
|
||||
# del l[i]
|
||||
# else:
|
||||
# l[i] //= 2
|
||||
# print(modify_list(l))
|
||||
# print(l)
|
||||
# modify_list(l)
|
||||
# print(l)
|
||||
l= [1, 3, 5]
|
||||
def modify_list(l):
|
||||
for i in range(len(l))[::-1]:
|
||||
if l[i] %2 !=0:
|
||||
l.remove(l[i])
|
||||
else:
|
||||
l[i] = l[i]//2
|
||||
modify_list(l)
|
||||
print(l)
|
||||
# l = [1,2,3,4]
|
||||
# def modify_list(l):
|
||||
# l[:] = [i//2 for i in l if not i % 2]
|
||||
# modify_list(l)
|
||||
# print(l)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user