Tuesday, 6 February 2024

Class 11 CS Practical - 10

 

10 - Write a program in Python to generate the following pattern using nested loops:

12345

1234

123

12

1


for i in range(5,0,-1):

    for j in range(1,i+1):

        print(j,end='')

    print()

 

Output:

12345

1234

123

12

1


Class 11 CS Practical - 09

 

9: Write a program in Python to generate the following pattern using nested loops:

1

22

333

4444

55555


for i in range(1,6):

    for j in range(1,i+1):

        print(i,end='')

    print()

Output:

 

1

22

333

4444

55555


Class 11 CS Practical - 08

 

8 - Write a program in Python to generate the following pattern using nested loops:

1

12

123

1234

12345


for i in range(1,6):

    for j in range(1,i+1):

        print(j,end='')

    print()

Output:

1

12

123

1234

12345


Class 11 CS Practical - 07

 

7. Write a program in Python to generate the following pattern using nested loops:

11111

22222

33333

44444

55555

for i in range(1,6):

    for j in range(1,6):

        print(i,end='')

    print()

Output:

11111

22222

33333

44444

55555

Class 11 CS Practical - 06

 

6. Write a program in Python to generate the following pattern using nested loops:

12345

12345

12345

12345

12345


for i in range(1,6):

    for j in range(1,6):

        print(j,end='')

    print()

Output:

12345

12345

12345

12345

12345

Class 11 CS Practical - 05

 

5. Write a program in Python to Input three numbers and display the smallest number.


a=int(input("Enter First Number: "))

b=int(input("Enter Second Number: "))

c=int(input("Enter Third Number: "))

if a<=b and a<=c:

    print(a," is smallest number")

elif b<=a and b<=c:

    print(b," is smallest number")

else:

    print(c," is smallest number")

Output:

Enter First Number: 8

Enter Second Number: 5

Enter Third Number: 6

5  is smallest number

Enter First Number: 7

Enter Second Number: 9

Enter Third Number: 2

2  is smallest number

 

Enter First Number: 4

Enter Second Number: 6

Enter Third Number: 9

4  is smallest number

Class 11 CS Practical - 04

 

4. Write a program in Python to Input three numbers and display the largest number.

a=int(input("Enter First Number: "))

b=int(input("Enter Second Number: "))

c=int(input("Enter Third Number: "))

if a>=b and a>=c:

    print(a," is largest number")

elif b>=a and b>=c:

    print(b," is largest number")

else:

    print(c," is largest number")

Output:

 

Enter First Number: 6

Enter Second Number: 7

Enter Third Number: 8

8  is largest number

 

Enter First Number: 8

Enter Second Number: 7

Enter Third Number: 4

8  is largest number

Enter First Number: 5

Enter Second Number: 9

Enter Third Number: 7

9  is largest number

 

Enter First Number: 7

Enter Second Number: 7

Enter Third Number: 7

7  is largest number

Class 11 CS Practical - 03

 

3. Write a program in Python to Input two numbers and display the smaller number.


a=int(input("Enter First Number: "))

b=int(input("Enter Second Number: "))

if a<b:

    print(a," is smaller than ",b)

elif b<a:

    print(b,"is smaller than ",a)

else:

    print("Both numbers are equal")

 

Output:

Enter First Number: 5

Enter Second Number: 3

3  is smaller than  5

 

Enter First Number: 6

Enter Second Number: 9

6 is smaller than  9

 

Enter First Number: 5

Enter Second Number: 5

Both numbers are equal


Class 11 CS Practical - 02


2. Write a program in Python to Input two numbers and display the larger number.

a=int(input("Enter First Number: "))

b=int(input("Enter Second Number: "))

if a>b:

    print(a," is greater than ",b)

elif b>a:

    print(b,"is greater than ",a)

else:

    print("Both numbers are equal")

 

Output:

Enter First Number: 5

Enter Second Number: 3

5  is greater than  3

 

Enter First Number: 6

Enter Second Number: 9

9 is greater than  6

 

Enter First Number: 5

Enter Second Number: 5

Both numbers are equal


Class 11 CS Practical - 01


1. Write a program in Python to Input a welcome message and display it.

msg=input("Enter a message: ")

print("Your Message is : ",msg)

Output:

Enter a message: Python

Your Message is :  Python