cs final program project
cs final program project
INPUT:-
OUTPUT:-
2. Input a welcome message and display it.
INPUT:-
OUTPUT:-
3. Generate the following patterns using nested
loops.
PATTERN - 1 PATTERN - 2 PATTERN – 3
* 12345 A
** 1234 AB
*** 123 ABC
**** 12 ABCD
***** 1 ABCDE
INPUT:-
OUTPUT:-
4. Input three numbers and display the
larger/smaller number.
INPUT:-
OUTPUT:-
5. Input two numbers and display tha larger/smaller
number.
INPUT:-
OUTPUT:-
6. Read a text file and display each word separated
by a ‘#’.
INPUT:-
OUTPUT:-
7. Create a dictionary with the roll number , name
and marks of an students in class and display the
names of students who have marks above 75.
INPUT:-
OUTPUT:-
8. Count and display the numbers of vowels ,
consonents , uppercase and lowercase characters
in string.
INPUT:-
OUTPUT:-
9. Remove all the lines that contains the character
‘a’ in the file and write to another file.
INPUT:-
OUTPUT:-
10. Write a function dispBook(BOOKS) in Python,
that takes a dictionary BOOKS as an argument
and displays the names in uppercase of those
books whose name starts with a consonant.
For example, Consider the following dictionary
INPUT:-
OUTPUT:-
11. Write a code to read the stack.
INPUT:-
OUTPUT:-
12. Write a program in python to display only
unique words.
INPUT:-
OUTPUT:-
13. Write a program in python which display the
longest word.
INPUT:-
OUTPUT:-
14. Write a function addval() in python which will
add the record of “mobile.dat” . structure of
“mobile.dat” is [Mobile id , Mobile brand , Model
no and price].
INPUT:-
OUTPUT:-
15. Write a Python function that finds and
displays all the words longer than 5 characters
from a text file "Words.txt".
INPUT:-
OUTPUT:-
16. Write a Python Program containing a function
FindWord(STRING, SEARCH), that accepts two
arguments : STRING and SEARCH, and prints the
count of occurrence of SEARCH in STRING. Write
appropriate statements to call the function.
INPUT:-
OUTPUT:-
17. Write a function, lenWords(STRING), that
takes a string as an argument and returns a tuple
containing length of each word of a string.
INPUT:-
OUTPUT:-
18. consider a file, SPORT.DAT, containing
records of the following structure:
[SportName, TeamName, No_Players]
INPUT:-
OUTPUT:-
19. Create a function maxsalary() in Python to
read all the records from an already existing file
record.csv which stores the records of various
employees working in a department. Data is
stored under various fields as shown below:
Table like :
E_name E_id Scale salary
INPUT:-
raju S1 100000 20000
OUTPUT:-
20. Write the definition of a function Sort() in
Python to sort the elements in Ascending and
descending order.
INPUT:-
OUTPUT:-
21. Write a user defined function
findname(name) where name is an argument in
Python to delete phone number from a dictionary
phonebook on the basis of the name, where
name is the key.
INPUT:-
OUTPUT:-
22. Write a function sum_of_elements(lst) that
takes a list of numbers lst and returns the sum of
all its elements.
INPUT:-
OUTPUT:-
23. Write a function max_element(lst) that finds
and returns the largest number in the list lst.
INPUT:-
OUTPUT:-
24. Write a function min_element(lst) that finds
and returns the smallest number in the list lst.
INPUT:-
OUTPUT:-
25. Write a function list_average(lst) that
calculates and returns the average of the
numbers in the list lst.
INPUT:-
OUTPUT:-
26. Write a function reverse_list(lst) that takes a
list lst and returns a new list that is the reverse of
lst.
INPUT:-
OUTPUT:-
27. Write a function element_frequency(lst) that
returns a dictionary where keys are the elements
of lst and values are the frequencies.
INPUT:-
OUTPUT:-
28. Write a function
filter_dict_by_key_start(original_dict, letter) that
filters a dictionary, returning a new dictionary
containing only those keys that start with the
specified letter.
INPUT:-
OUTPUT:-
29. Create a function
check_key_existence(dictionary, key) that checks
if a given key exists in the dictionary and returns a
message indicating whether the key is present or
not.
INPUT:-
OUTPUT:-
30. Write a program to calculate the factorial of a
given number.
INPUT:-
OUTPUT:-
31. Write a program to find the sum of the first n
natural numbers.
INPUT:-
OUTPUT:-
32. Write a program to count the number of digits in a given
number.
INPUT:-
OUTPUT:-
33. Write a python program to implement a stack using list.
INPUT:-
OUTPUT:-
34. Input a string and determine whether it is a palindrome or not;
convert the case of characters in a string.
INPUT:-
OUTPUT:-
35. compute the greatest common divisor and least common
multiple of two integers.
INPUT:-
OUTPUT:-
36. write a python code to determine whether the number is a
perfect number, an armstrong number or a palindrome.
INPUT:-
OUTPUT:-
37. Write a program to input the value of x and n and print the sum
of the given series:
1-x+x^2-x^3+x^4-..x^n
INPUT:-
OUTPUT:-
38.Write a program to input the value of x and n and print the sum
of the given series:
INPUT:-
OUTPUT:-
39.Input a list of numbers and swap elements at the even location
with the elements at the odd location.
INPUT:-
OUTPUT:-
40. Write a program to find the sum of the series 1 + 1/2 + 1/3 + ... +
1/n.
INPUT:-
OUTPUT:-
41. Display the terms of a Fibonacci series.
INPUT:-
OUTPUT:-
42. input a number and check if the number is prime or composite
number.
INPUT:-
OUTPUT:-
43. Write a program to calculate simple interest given
principal, rate, and time.
INPUT:-
OUTPUT:-
44. Write a program to check if a given year is a leap year.
INPUT:-
OUTPUT: -