0% found this document useful (0 votes)
10 views4 pages

Day _2 7Dec2022 python workshop

Uploaded by

Dimon He
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Day _2 7Dec2022 python workshop

Uploaded by

Dimon He
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

In [2]:

n=int(input())
i=n
while i>=0:
print(i)
i=i-1

5
5
4
3
2
1
0

In [3]:

n=int(input())
for i in range(n):
print(i)

3
0
1
2

In [6]:

n=int(input())
for i in range(n):
print(i,end=' ')

5
0 1 2 3 4

In [7]:

n=int(input())
for i in range(0,n,2):
print(i,end=' ')

10
0 2 4 6 8

In [11]:

n=int(input())
for i in range(n,-1,-1):
print(i,end=' ')

5
5 4 3 2 1 0
In [12]:

n=int(input())
for i in range(n,-1,-2):
print(i,end=' ')

5
5 3 1

In [15]:

n=int(input())
for i in range(2,n+1,+2):
print(i,end=' ')

10
2 4 6 8 10

In [18]:

n=int(input())
for i in range(1,n+1,+2):
print(i,end=' ')

11
1 3 5 7 9 11

In [19]:

n=int(input())
for i in range(n):
print(i)

5
0
1
2
3
4

In [21]:

n=int(input())
for i in range(1,n):
print('*')

5
*
*
*
*
In [34]:

n=int(input())
for i in range(1,n+1):
for j in range(i):
print('*')

5
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

In [45]:

n=int(input())
for i in range(1,n+1):
for j in range(i):
print('*',end='' )
print()

5
*
**
***
****
*****
In [1]: n=int(input())
for i in range(n,0,-1):
for j in range(i):
print('*',end='' )
print()

5
*****
****
***
**
*

In [ ]:

You might also like