Professional Documents
Culture Documents
The passport number is the key and client details are the value. Write a program
to get the value(Client details) by giving the key(passport number) from the
dictionary.
Input Format
First line of the input consists of number of passengers n.
Last line of the input consists of string representing passport number whose
detail needs to be fetched.
Output Format
Output displays the information if the passport number is present in the
dictionary.
Sample Input 1
2
Shri shri@mail.com
7346218
Veena veena@gmail.com
8639124
12354545
Sample Output 1
Client not found
Sample Input 2
2
Shri shri@mail.com
7346218
Veena veena@mail.com
8639124
8639124
Sample Output 2
Veena--veena@mail.com--8639124
2.) Write a Python script to generate and print a dictionary that contains a
number (between 1 and n) in the form (x, x*x).
Sample Dictionary ( n = 5) :
3.) Write a Python program to create and display all combinations of letters,
selecting each letter from a different key in a dictionary.
Expected Output:
ac
ad
bc
bd
4.) Write a Python program to get the top three items in a shop.
Sample data: {'item1': 45.50, 'item2':35, 'item3': 41.30, 'item4':55, 'item5': 24}
Expected Output:
item4 55
item1 45.5
item3 41.3
Original Dictionary:
{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}
Output:
Marks greater than 170:
{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}
7.) Consider a input file "numbers.txt" with integer values. Write a program to Open
the file and sort the content of the file in ascending order.
Input Format
No console input
Output Format
Display the file content in ascending order in the console as a list
8.) Write a program to copy the content from one file to another file.
Rules:
The input file should be named as "input.txt".
The output file should be named as "output.txt".
Input Format
No input
Output Format
Display the contents in the file.
9.) Consider a input file "numbers.txt" with integer values. Write a program to Open
the file and read the content to find the sum of all values in the file.
Input Format
No console input
Output Format
The output will be the integer which is sum of the intergers. Display the output in
the console.
Sample Output 1
2849