-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPython_Project_Questions.txt
95 lines (32 loc) · 2.86 KB
/
Python_Project_Questions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Q1:
You are working in a bank, and you have been given two lists of the employees who worked in 2021. Employees’ names in list 1 are Ramesh, Suresh, Mahesh, Ali, Jacob, and Saritha. List 2 contains the names of Ali, Mukesh, Mahesh, Jacob, Sai, and Sarita. Please write a program that helps to identify people who are common in both lists. Please do not use any in-built function.
Q2:
While entering data, someone entered a few names as a common string “Ramesh Suresh Mohit”. Please write a program which separates all the names and converts them into a list. Once converted into a list, please write a program that adds their age.
Ramesh: 25
Suresh: 22
Mohit: 26
Q3:
You are working in a medical store. A patient came to your medical store and asked to buy 2 strips of paracetamol, 3 strips of azithromycin, and 5 strips of Vitamin C. One strip of paracetamol costs Rs 35, one strip of azithromycin costs Rs 49, and one strip of vitamin c costs Rs. 33. Patient gave you Rs 2000. Please tell us what is the total cost of each medicine, the total cost of all medicine, and how much money you refunded to the patient.
Q4:
Accept a sentence as input and find the number of vowels in it. Assume that the sentence has no punctuation marks. For example, I am learning python contains 6 vowels. This function should be applicable for all other different sentences.
Q5:
You have been appointed by the election commission to create a website. Your first task is to work on a program which tells candidates if they are eligible for voting or not. If they are eligible, your output should be ‘Congrats! You are eligible’; otherwise, it should tell that you have to return after X number of years. The eligibility criteria for voting is 18 years.
For example, If someone is 18 or above, your output should be ‘Congrats! You are eligible’. If someone’s age is 15 years, it should print output as ‘return after 3 years’.
Q6:
Given a list of integers, find the cumulative sum of the elements of the list and store them in another list.
A = [1, 2, 3, 4, 5]
Output:
[1, 3, 6, 10, 15]
Q7:
WAP to encode a message entered by user as per below conditions:
for every word in the sentence,
1. If the word starts with a vowel, encode it as the first and last letter of the word.
2. If the word starts with a consonant, remove all vowels from it.
Ensure the case insensitive comparisons/checks are performed.
Please enter your text:The quick brown fox used to sleep inside this box
Encoded Msg: Th qck brwn fx ud t slp ie ths bx
Q8:
Write a program to implement run length encoding of a string
RLE:Consecutive repetition of a character has to be replaced with the count of occurrences and the character.
Enter your string :aabbbccdddae
Encoded: 2a3b2c3d1a1e