Learn practical skills, build real-world projects, and advance your career

Question 1:

Print First 10 natural numbers using while loop

i = 0
while i != 11:
    print(i)
    i+=1
0 1 2 3 4 5 6 7 8 9 10

Question 2:

Print the following pattern

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

for i in range(1,7):
    for j in range (1,i):
        print(j,end='')
    print('\n')
1 12 123 1234 12345

Question 3:

Accept number from user and calculate the sum of all number between 1 and given number