0% found this document useful (0 votes)
15 views12 pages

Class 11 Journal 2024-25

The document is an index of programming exercises with their corresponding dates, covering a range of topics such as calculating areas, determining even or odd numbers, finding the largest integer, and working with strings and tuples. Each entry includes a brief description of the task and a sample implementation in Python. The exercises are designed to enhance programming skills and understanding of basic algorithms.

Uploaded by

kang haerin
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)
15 views12 pages

Class 11 Journal 2024-25

The document is an index of programming exercises with their corresponding dates, covering a range of topics such as calculating areas, determining even or odd numbers, finding the largest integer, and working with strings and tuples. Each entry includes a brief description of the task and a sample implementation in Python. The exercises are designed to enhance programming skills and understanding of basic algorithms.

Uploaded by

kang haerin
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/ 12

INDEX

S.NO. PROGRAM DATE


1 Write a program that accepts base and height and calculate the area of triangle 7/8/24
2 Write a program to find whether a given number is even or odd. 8/8/24
3 Write a program to find largest among three integers 9/8/24
4 Write a program that reads the number n and print the value of n², n³ and n⁴. 11/9/24
5 Write a program that accepts the age and print if one is eligible to vote or not. 11/9/24
6 Write a program to obtain x, y, z and calculate 4x⁴+3y³+9z+6π 12/9/24
7 Write a program to input a number and print its square if it is odd, if it is not odd then 12/9/24
print its square root.
8 Write a program to input percentage marks of a student and find the grade as per 13/9/24
given criterion
9 Write a program to enter a number and check if it is a prime number or not. 13/9/24
10 Write a program to display a menu for calculating area of circle or perimeter of the 8/10/24
circle.
11 Write a program to print whether a given character is an uppercase or a lowercase 8/10/24
character or a digit or any other character.
12 Write a program to calculate the factorial of a number. 8/10/24
13 Write a program to create a triangle of stars using nested loop. 9/10/24
14 Write a Python script to print Fibonacci series’ first 10 elements. 9/10/24
15 Write a program to read an integer>1000 and reverse the number. 9/10/24
16 write program to print the pattern as given below: 10/10/24
17 Write a program to find sum of series : s=1+x+x²+x³+x⁴…+xⁿ 10/10/24
18 . #Program that reads a line and print its statistics 10/10/24
19 Write a program that reads a line and a substring and displays the number of 11/10/24
occurrences of the given substring in the line.
20 Write a program that takes a string with multiple words and then capitalizes the first 11/10/24
letter of each word and forms a new string out of it.
21 Write a program that reads a string and checks whether it is a palindrome string or 18/11/24
not.
22 Write a program that reads a string and displays the longest substring of the given 18/11/24
string having just the consonants.
23 WAP to display frequencies of all the elements of a list. 19/11/24
24 WAP in Python to find and display the sum of all the values which are ending with 3 19/11/24
from a list.
25 WAP to accept values from user and create a tuple. 2/12/24
26 WAP to input any two tuples and swap their values 2/12/24
27 Write a program to input total number of sections and stream name in 11th class and 2/12/24
display all information on the output screen.
28 WAP to store students’ details like admission number, roll number, name and 2/12/24
percentage in a dictionary and display information on the basis of admission number.
29 Write a program to input n numbers from the user. Store these numbers in a tuple. 3/12/24
Print the maximum, minimum, sum and mean of number from this tuple.
30 Write Python program using random module to do the following: 4/12/24
1. Write a program that accepts base and height and calculate the area of triangle

b=float(input('Enter the base of triangle:'))


h=float(input('Enter the height of triangle:'))

Area=(1/2)*b*h

print('The area of triangle is:', Area)

2. Write a program to find whether a given number is even or odd.

a=int(input('Enter the number:'))


if a%2==0:
print('The number is even')
else:
print('The number is odd')

3. Write a program to find largest among three integers

a=int(input('Enter the first integer:'))


b=int(input('Enter the second integer:'))
c=int(input('Enter the third integer:'))

if a>b and a>c:


print(a, 'is the largest integer')
if b>a and b>c:
print(b, 'is the largest integer')
if c>a and c>b:
print(c, 'is the largest integer')

4. # Write a program that reads the number n


# and print the value of n², n³ and n⁴.

a=float(input('Enter the value of n:'))


b=a**2
c=a**3
d=a**4
print('The value of n² is:', b)
print('The value of n³ is:', c)
print('The value of n⁴ is:', d)
5. # Write a program that accepts the age and print if one is eligible to vote or not.
a=int(input('Enter your age:'))
if a>=18:
print('You are eligible to vote')
else:
print('You are not eligible to vote')

6. # Write a program to obtain x, y, z and calculate 4x⁴+3y³+9z+6π.

import math
print('To calculate 4x⁴+3y³+9z+6π')
x=float(input('Enter the number x:'))
y=float(input('Enter the number y:'))
z=float(input('Enter the number z:'))

b=(4*math.pow(x,4))+(3*math.pow(y,3))+(9*z)+(6*math.pi)
print('The result of the above expression is:',b)

7. # Write a program to input a number and print its square if it is odd, if it is not odd then print its
square root.

import math

x=float(input('Enter the number:'))

a=math.pow(x,2)
b=math.sqrt(x)
if x%2!=0:
print('The value of square is:',a)
else:
print('The value of square root is:',b)

8. Write a program to input percentage marks of a student and find the grade as per following
criterion:
Marks Grade
>=90 A
75-90 B
60-75 C
Below 60 D
'''
a=float(input('Enter the percentage marks:'))
if a>=90:
print('The student has got an A grade')
elif a>=75 and a<90:
print('The student has got a B grade')
elif a>=60 and a<75:
print('The student has got a C grade')
else:
print('The student has got a D grade')

9. # Write a program to enter a number and check if it is a prime number or not.

num=int(input('Enter the number:'))


for i in range(2,num//2+1):
if num%i==0:
print('It is not a prime no.')
break
else:
print('It is a prime number')

10. # Write a program to display a menu for calculating area of circle or perimeter of the circle.

r=float(input('Enter the radius of the circle:'))

while True:

print('1.Calculate perimeter')

print('2.Calculate area')

print('3.Exit')

choice=int(input('Enter your choice (1 or 2 or 3):'))

if choice==1:

peri=2*3.14159*r

print('Perimeter of the circle with radius',r,':',peri)

elif choice==2:

area=3.14159*r*r

print('Area of the circle of the radius',r,':',area)

else:

break

11. # Write a program to print whether a given character is an uppercase or a lowercase character or
a digit or any other character.

ch=input('Enter a single character:')


if ch>='A'and ch<='Z':
print('You have entered an uppercase character.')
elif ch>='a'and ch<='z':
print('You have entered an lowercase character.')
elif ch>='0'and ch<='9':
print('You have entered a digit.')
else:
print('You have entered a special character.')

12 # Write a program to calculate the factorial of a number.

num=int(input('Enter a number:'))
fact=1
a=1
while a<=num:
fact*=a
a+=1
print('The factorial of',num,'is',fact)

13. # Write a program to create a triangle of stars using nested loop.

for i in range(1,6):
print()
for j in range(1,i):
print('*',end=' ')

14. # Write a Python script to print Fibonacci series’ first 10 elements.

first=0
second=1
print(first, end=' ')
print(second,end=' ')
for a in range(1,9):
third=first+second
print(third,end=' ')
first,second=second,third

15. # Write a program to read an integer>1000 and reverse the number.

num=int(input('Enter a number (>1000):'))


tnum=num
reverse=0
while tnum>0:
digit=tnum%10
reverse=reverse*10+digit
tnum=tnum//10
print('Reverse of',num,'is',reverse)
16. write program to print the pattern as given below:

'''
1
13
135
1357
'''
for a in range(3,10,2):
print()
for b in range(1,a,2):
print(b, end=' ')
print()

17. # Write a program to find sum of series : s=1+x+x²+x³+x⁴…+xⁿ

x=float(input('Enter the value of x:'))


n=int(input('Enter the value of n (for x**n):'))
s=0
for a in range(n+1):
s+=x**a
print('Sum of first' ,n,'terms:',s)

18. #Program that reads a line and print its statistics like:
'''
Number of uppercase letters:
Number of lowercase letters:
Number of alphabets:
Number of digits:
'''

line=input('Enter a line:')
lowercount=uppercount=0
digitcount=alphacount=0

for a in line:
if a.islower():
lowercount+=1
elif a.isupper():
uppercount+=1
elif a.isdigit():
digitcount+=1
if a.isalpha():
alphacount+=1
print('Number of uppercase letters are:',uppercount)
print('Number of lowercase letters are:',lowercount)
print('Number of alphabets are:',alphacount)
print('Number of digits are:',digitcount)

19. #Write a program that reads a line and a substring and displays the number of occurrences of the
given substring in the line.

line=input('Enter line:')
sub=input('Enter substring:')
length=len(line)
lensub=len(sub)
start=count=0
end=length

while True:
pos=line.find(sub,start,end)
if pos!=-1:
count+=1
start=pos+lensub
else:
break
if start>=length:
break
print('No. of occurences of',sub,':',count)

20. #Write a program that takes a string with multiple words and then capitalizes the first letter of
each word and forms a new string out of it.

string=input('Enter a string:')
length=len(string)
a=0
end=length
string2=''

while a<length:
if a==0:
string2+=string[0].upper()
a+=1
elif(string[a]==' ' and string[a+1]!=' '):
string2+=string[a]
string2+=string[a+1].upper()
a+=2
elif (string[a]==',' and string[a+1]!=','):
string2+=string[a]
string2+=string[a+1].upper()
a+=2
else:
string2+=string[a]
a+=1
print('Original string:',string)
print('Capitalized words string:',string2)

21. #Write a program that reads a string and checks whether it is a palindrome string or not.

string=input('Enter a string:')
length=len(string)
mid=length//2
rev=-1
for a in range(mid):
if string[a]==string[rev]:
print(string,'is a palindrome.')
break
else:
print(stri

22. Write a program that reads a string and displays the longest substring of the given string having
just the consonants.

string=input('Enter a string:')
length=len(string)
maxlength=0
maxsub=''
sub=''
lensub=0
for a in range(length):
if string[a] in 'aeiou' or string[a] in 'AEIOU':
if lensub>maxlength:
maxsub=sub
maxlength=lensub
sub=''
lensub=0
else:
sub+=string[a]
lensub=len(sub)
a+=1
print('Maximum length consonant substring is:',maxsub,end=' ')
print('with',maxlength,'characters')

23. # WAP to display frequencies of all the elements of a list.


L= [3, 21, 5, 6, 3, 8, 21, 6]
L1= [ ]
L2= [ ]
print ('Element' , ' \t' , 'frequency' )

for i in L:
if i not in L2:
x=L.count(i)
L1.append(x)
L2.append(i)

for i in range(len(L1)):
print (L2[i],'\t\t\t',L1[i])

24. # WAP in Python to find and display the sum of all the values which are ending with 3 from a list.

L=[33,13,92,99,3,12]
sum=0
x=len (L)
for i in range(0,x):
if type (L [i])== int:
if L[i]%10==3:
sum+=L[i]
print (s

25. # WAP to accept values from user and create a tuple.


t=tuple()
n=int(input("How many values you want to enter: "))
for i in range(n):
a=input("Enter Number: ")
t=t+(a,)
print("Entered Numbers are: ")
print(t)

26.# WAP to input any two tuples and swap their values

t1 = tuple()
n = int (input("Total no of values in First tuple: "))
for i in range(n):
a = input("Enter Elements : ")
t1 = t1 + (a,)
t2 = tuple()
m = int (input("Total no of values in Second tuple: "))
for i in range(m):
a = input("Enter Elements : ")
t2 = t2 + (a,)
print("First Tuple : ")
print(t1)
print("Second Tuple : ")
print(t2)

t1,t2 = t2, t1

print("After Swapping: ")


print("First Tuple : ")
print(t1)
print("Second Tuple : ")
print(t2)

27. # Write a program to input total number of sections and stream name in 11th class and display all
information on the output screen.
classxi=dict()
n=int(input("Enter total number of section in xi class: "))
i=1
while i<=n:
a=input("Enter Section: ")
b=input ("Enter stream name: ")
classxi[i]=b
i=i+1
print ("Class",'\t''Section''\t''Stream name')
for i in classxi:
print ("XI",'\t',i,'\t',classxi[i])

28. # WAP to store students’ details like admission number, roll number, name and percentage in a
dictionary and display information on the basis of admission number.

record = dict ()
i=1
n= int (input ("How many records u want to enter: "))
while(i<=n):
Adm = input("Enter Admission number: ")
roll = input("Enter Roll Number: ")
name = input("Enter Name :")
perc = float(input("Enter Percentage : "))
t = (roll,name, perc)
record[Adm] = t
i=i+1
Nkey = record.keys()
for i in Nkey:
print("\nAdmno- ", i, " :")
r = record[i]
print("Roll No\t", "Name\t", "Percentage\t")
for j in r:
print(j, end = "\t")

29. Write a program to input n numbers from the user. Store these numbers in a tuple. Print the
maximum, minimum, sum and mean of number from this tuple.

# Write a program to input n numbers from the user.


# Store these numbers in a tuple. Print the maximum,
# minimum, sum and mean of number from this tuple.

numbers = tuple() #create an empty tuple 'numbers'


n = int(input("How many numbers you want to enter?: "))
print("Enter any ",n," numbers")
for i in range(0,n):
num = int(input())
#it will assign numbers entered by user to tuple 'numbers'
numbers = numbers +(num,)
print('\nThe numbers in the tuple are:')
print(numbers)
print("\nThe maximum number is: ")
print(max(numbers))
print("The minimum number is: ")
print(min(numbers))
print("The sum of numbers is: ")
print(sum(numbers))
print("The mean of numbers is: ")
mean = sum(numbers)/(i+1)
print(mean)
ele=int(input("Enter the element to be searched: "))
if ele in numbers:
print("Element found")
else:
print("Element not found")
30. Write Python program using random module to do the following:

a. This function can be used to generate random floating-point values.

b. The above code will generate random numbers between 10 to 20.

c. This function returns a random integer between a given start and stop integer.

d. Used for making a random selection from a sequence (list, tuple, string)

e. Used to shuffle the contents in a sequence (list).

import random

random_number=random.random()

print(random_number)

random_number=random.randrange(10,21)

print(random_number)

random_number=random.randint(100,200)

print(random_number)

my_choice=random.choice(["RED","YELLOW","GREEN", "BLUE"])

print(my_choice)

color=["RED","YELLOW","GREEN", "BLUE"]

random.shuffle(color)

print(color)

You might also like