Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Madhav Institute of Technology and Science, Gwalior

(A Govt. Aided UGC Autonomous & NAAC Accredited Institute Affiliated to RGPV, Bhopal)
Department of Computer Science & Engineering
Assignment: Summer internship in “Python Programming & its Applications”

Q1 Flip Jewellery store sells variety of jewels to its customers.


Write a Python program to calculate the bill_amount for customers based on the list of jewels
(purchased_jewels_list) and quantity purchased (purchased_quatity_in_grams_list).
• Any purchase with the bill amount above 20000 is entitled for 3% discount
• If any of the jewels required by the customer is not available in the store, then consider the
bill amount to be -1
• Jewels available in store with the corresponding price is given below:
avail_jewel_price_per_gram_dict = {“Bentex”: 20, "Silver”: 50, "Gold”: 2600, "Platinum”:
3000}
avail_jewel_price_per_gram_dict contains jewel as key(string) and price per gram as the
corresponding value(integer) i.e the price of “Silver” per gram is 50 Rs similarly “Gold” per gram
is 2600 Rs and so on.
Example:
purchased_jewels_list purchased_quatity_in_grams_list bill_amount
(Output)
[ "Silver", "Gold", "Platinum”] [ 20, 7, 3] 27354.0
[ "Silver", "Gold", "Platinum”] [5, 2, 5] 19836.5
[ "Silver", "Bentex"] [8, 20] 800.0

Q2 Write a Python program that takes input_string as a parameter and returns an output_dict based
on the logic given below-
• output_dict would have keys as “LETTERS” and values as “COUNT”
• Value corresponding to key “LETTERS” would be an output_list1 which would contain
the unique letters in the input_string
• Value corresponding “COUNT” would be an output_list2 which would contain the count
of corresponding letters in the output_list1
• Elements in output_list2 are stored in descending order of counts and the letters
corresponding to the count in output_list1
• If there are more than one letter with the same count, then the letters are stored in the same
order as they appear in input_string
Example:

input_string output_dict
RadeepeekaaRrm LETTERS = ['e', 'a', 'R', 'd', 'p', 'k', 'r', 'm'],
COUNT = [4, 3, 2, 1, 1, 1, 1, 1]
Mississippi LETTERS = [I, s, p, M],
COUNT = [4, 4, 2, 1]}
Continue LETTERS = [n, C, o, t, i, u, e],
COUNT = [2, 1, 1, 1, 1, 1, 1]}
Madhav Institute of Technology and Science, Gwalior
(A Govt. Aided UGC Autonomous & NAAC Accredited Institute Affiliated to RGPV, Bhopal)
Department of Computer Science & Engineering
Assignment: Summer internship in “Python Programming & its Applications”

Q3 Write a Python program to check the validity of a password given by the user.
The Password should satisfy the following criteria:
1. Contain at least 1 letter between a and z
2. Contain at least 1 number between 0 and 9
3. Contain at least 1 letter between A and Z
4. Contain at least 1 character from $, #, @
5. Minimum length of password: 6
6. Maximum length of password: 12

Sample Input Password Sample Output


Ram@122 Valid
1254856#F Invalid
KumarAnand$1258 Invalid
Aj$5 Invalid
Ajay$15 Valid

Q4 Given an list of “n” integers where each value represents number of chocolates in a packet. Each
packet can have variable number of chocolates. There are “m” students, the task is to distribute
chocolate packets among the students such that:
• Each student gets one packet.
• The difference between the number of chocolates in a packet with maximum chocolates
and the packet with minimum chocolates given to the students is minimum.
• If m > n, then no chocolate distribution.
Example – 1:
Note: take the list of chocolate-packets as: [12, 4, 7, 9, 2, 23, 25, 41,30, 40, 28, 42, 30, 44, 48, 43,
50]
Sample Input: m = 7
Sample Output:
Selected packets of chocolates: 40, 41, 42, 43, 44, 48, 50
Minimum Distance: 10

Example – 2:
Take the list of chocolate-packets as: [2,80,56,47,23,15,32,18,12,8,90,35,47,44]
Sample Input: m = 6
Sample Output:
Selected packets of chocolates: [2, 8, 12, 15, 18, 23]
Minimum Distance: 21
Madhav Institute of Technology and Science, Gwalior
(A Govt. Aided UGC Autonomous & NAAC Accredited Institute Affiliated to RGPV, Bhopal)
Department of Computer Science & Engineering
Assignment: Summer internship in “Python Programming & its Applications”

Q5. Write a python program which implements the following class diagram and create 5 objects of
Employee class:
Employee
-name: string
-id: int
-Salary: int
-employee_count → static
__init__(name,id,address)
+displayEmployeeDetails( )
+displayAverageSalary( ) → static

You might also like