COMPUTER SCIENCE
REPORT FILE
[PYTHON]
SUBMITTED BY
Name:- Aakash Lohiya Class:- 11th
Session :- 2023-24
ACKNOWLEDGEMENT
I wish to express my deep sense of gratitude and indebtedness to
our learned teacher MR. JITENDRA AHUJA, PGT COMPUTER
SCIENCE, AHMEDABAD PUBLIC SCHOOL INTERNATIONAL for
his invaluable help, advice and guidance in the preparation of this
project.
I am also greatly indebted to our principal MS. RONAK ZAVERI
and school authorities for providing me with the facilities and requisite
laboratory conditions for making this practical file.
I also extend my thanks to a number of teachers, my classmates
and friends who helped me to complete this practical file successfully..
TABLE OF CONTENT
1. Input a welcome message and display it.
2. Input two numbers and display the larger/smaller number.
3. Input three numbers and display the largest / smallest number.
4. Generate the following pattern using nested loop:
*****
****
***
**
*
5. Generate the following pattern using nested loop:
12345
1234
123
12
1
6. Generate the following pattern using nested loop:
A
AB
ABC
ABCD
ABCDE
7. Generate the following pattern using nested loop:
ABCDE
ABCD
ABC
AB
A
8. Write a program to input the value of x and n and print the sum of the
following series: 1 + x + x² + x³ +...........”
9. Write a program to input the value of x and n and print the sum of the
following series: 1-x + x²-x3+x4
10. Determine whether a number is a perfect number, an Armstrong number
or a Palindrome.
11. Input a number and check if the number is a prime or composite number.
12. Display the terms of a Fibonacci series.
13. Compute the greatest common divisor and least common multiple of two
integers.
14. Count and display the number of vowels, consonants, uppercase,
lowercase characters in string.
15. Input a string and determine whether it is a palindrome or not; convert the
case of characters in a string.
16. Find the largest/smallest number in a list/tuple.
17. Input a list of numbers and swap elements at the even location with the
elements at the odd location.
18. Input a list/tuple of elements, search for a given element in the list/tuple.
19. Input a list of numbers and find the smallest and largest number from the
list.
20. Create a dictionary with the roll number, name and marks of n students in
a class and display the names of students who have scored marks above
75.
SOURCE CODE & OUTPUT
Question 1 : message=input(“Enter welcome message : “)
Print(“Hello, “,message)
Question 2 : print("Enter Two Numbers: ")
numOne = int(input())
numTwo = int(input())
if numOne>numTwo:
print("\nLargest Number =", numOne)
else:
print("\nLargest Number =", numTwo
Question 3 : n1 = float(input())
n2 = float(input())
n3 = float(input())
if (n1 > n2) and (n1 > n3): large = n1
elif (n2 > n1) and (n2 > n3): large = n2
else: large = n3
print("The large number is", large)
Question 4 : for i in range(5):
for j in range(5-i):
print('*',end='')
print('')
Question 5 : for i in range(5):
for j in range(5-i):
print(j,end='')
print('')
Question 6 :
for i in range (65,70):
# inner loop
for j in range(65,i+1):
print(chr(j),end="")
print()
Question 7 : for i in range (70,65,-1):
for j in range(65,i):
print(chr(j),end="")
print()
Question 8 : int main()
{
int sum =1, x, n, i;
printf("Here we will calculate the sum of series 1+ x + x^2+ ...+ x^n \n");
printf("Enter the value of x: ");
scanf("%d", &x);
printf("Enter the value of n: ");
scanf("%d", &n);
for(i=1; i<=n;i++)
{
sum+=pow(x,i);
}
printf("The sum of the series is: %d", sum);
return 0;
}
Question 9: