Class 11 CBSE - Python Conditional & Looping Constructs Programs

Python is designed to understand the user’s responsibility, the protocol, and the ethical issues related to the field of computing.
Python in class 11 for cbse is very handy when it comes to practice on computers but for the beginers there might be some errors and problems such as exception. But it's always advisable to practice program on computer than writing it on paper because it cherishes your practical skills , knowledge and typing speed and you'll come to know new things and if you want to be a software developer someday then its a must call for you.
Program 1: Write a Python program to generate the table of the number inputted by the user.
Solution:
num = (int(input("Enter the number :")))
for i in range(1,11):
       print(num, 'x', i, '=', num*i)
                    

Program 2: Write a Python program to input a number and print the factorial of that number.
Solution:
 num = (int(input("Enter the number :")))
 fact = 1
 for i in range(1,num+1):
        fact=fact*i
 
 print('Factorial is =', fact)
                        

Program 3: Write a Python program to enter a number and count its digits and print.
Solution:
 num = (int(input("Enter the number :")))
 count=0
 while num > 0:
     count=count+1
     num=num/10
 
 print("No. of digits =", count)
                     
 
                        

                        

Program 4: Write a Python program to print the following pattern as shown below:

222
222
222
Solution:
i=2
while i>=0:
    j=2
    while j>=0:
        print(2, end=" ")
        j=j-1

    print()
    i=i-1
 

Program 5: Write a Python program to find the sum of all the positive number entered by the user. As soon as the user enters a negative number it stops taking in anymore number from them and display the sum.
Solution:
start=0
sum=0
print("Enter positive no , loop with end as soon as negative number is inputed")
while True:
    start= eval(input())
    if start < 0:
        break
    sum=sum+start

print("Sum is =", sum)

 

Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com