Krishna Gopal
Krishna Gopal
PUBLIC SCHOOL
CLASS : 10th – C
CERTIFICATE
TEACHER SIGNATURE:
ACKNOWLEDGEMENT
CODING :
sum = 0 count = 0 print("Enter numbers (enter
num = int(input())
if num == 0: break
+= 1 if count > 0:
OUTPUT :
15
Average: 10.0
PROBLEM 2 : write a program to check whether a number
is palindrome or not.
CODING :
dig=num%10
rev=rev*10+dig
num=num//10
if(temp==rev):
OUTPUT :
CODING :
p = float(input("Enter Principal amount: ")) r =
OUTPUT :
Enter time : 5
CODING:
i = 0 while i <=
num:
OUTPUT:
Enter a number: 64
CODING :
i=0
sum = 0 while
i<=100: sum =
sum + i
i = i+1
print("Sum = ",sum)
OUTPUT :
Sum = 5050
PROBLEM 5 : write a program to swap two numbers
without using the third variable
CODING :
x = int(input("Enter the value of x:")) y =
OUTPUT:
CODING :
n = int(input("Enter any Number :")) i = 1
= ",value) i = i + 1
OUTPUT:
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
PROBLEM 7 : write a progam to print whether a given
character is an uppercase or lowercase character or digit
or any other character.
CODING :
char = input("Enter a character: ") if
char.isupper():
char.islower():
char.isdigit(): print("Digit")
else:
print("Other character")
OUTPUT :
Digit
Uppercase letter
Lowercase letter
PROBLEM 9 : write a program to count the number of
vowels in a string using for loop.
CODING:
str = input("Please enter a string as you wish :") vowels = 0
for i in str : if i in
'aeiouAEIOU':
vowels:",vowels)
OUTPUT :
GOOD MORNING
CODING :
n = int(input("enter the number:")) factorial = 1 if n < 0 :
OUTPUT :
*
**
***
****
*****
CODING :
rows = int(input("Enter number of rows: ")) for i
OUTPUT :
* *
* **
* ***
* ****
PROBLEM 8 : write a program to display all numbers
within a range except the prime numbers.
CODING :
start_range = int(input("Enter the start of the range: ")) end_range =
is_prime = False
if not is_prime:
print(num)
OUTPUT :
15 16 18 20
PROBLEM 12 : write a program to input two numbers and
CODING :
print("Value of y:",y)
OUTPUT:
Value of x: 876
Value of y: 564
PROBLEM 13: write a program to print the following
pattern .
4321
432
43
CODING :
for i in range(1, 5): for j in
range(4, i - 1, -1):
OUTPUT :
4321
432
43
4
PROBLEM 11 : write a program to calculate the area of
circle, rectangle and triangle depending upon user choice.
The choice should be entered by the user in the form of a
menu. Wrong choice should be addressed.
CODING :
while True:
if choice == '1':
OUTPUT :
Menu:
1. Circle
2. Rectangle
3. Triangle
4. Exit
Enter radius: 4
Menu:
1. Circle
2. Rectangle
3. Triangle
4. Exit
Enter length: 25
Enter width: 15
Menu:
1. Circle
2. Rectangle
3. Triangle
4. Exit
Enter base: 15
Enter height: 20
Area of Triangle: 150.00
Menu:
1. Circle
2. Rectangle
3. Triangle