create a list of n zeros python code example
Example 1: make a zero list python
listofzeros = [0] * n
Example 2: python initialize list length n
Creating an empty list:
>>> l = [None] * 10
>>> l
[None, None, None, None, None, None, None, None, None, None]
Example 3: recursive python program to print numbers from n to 1
# Read the input
n = int(input())
def rec(n):
if n==0:
print(0)
else:
print(-n)
rec(n-1)
print(n)
rec(n)