Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Python FUNCTIONS AND DICTIONARY Mid Term exam

Rating
-
Sold
-
Pages
1
Grade
A+
Uploaded on
04-11-2021
Written in
2021/2022

Contains questions from my dictionary exam in University.

Institution
Course

Content preview

TEST 3 – FUNCTIONS AND DICTIONARIES



1) Consider a dictionary named student where the key is the name of the student and the
value is a list of size 5 which stores the marks of the student in 5 subjects. A sample
dictionary is as shown below:
student={“pia”:[67,45,89,90,55], “rohan” : [90, 91,92,88,91], “tina”:[45, 56, 47, 76, 68]}
Write a function in Python named topper which takes the dictionary student as a
parameter and display the name and the percentage of the student who is the topper.
(Assume there is only one topper)

2) Consider a dictionary named employee where the key is the name of the employee and
the value is another dictionary storing department and his/her salary. A sample
dictionary is shown below:
Employee={“pia”:{“dept”:”Sales”,”salary”:4500}, “rohan” :{“dept”:Accounts”,”salary”:
8000}, “tina”:{“dept”:”Sales”,”salary”:7200}}
Write a function in Python named display_employee that takes the dictionary Employee
and variable named dname as parameters and display the name and salary of all
employees belonging to the department stored in variable dname.
3) Give the output of the following program segment :
def control(ch,n=3):
for i in range(n):
print(ch,end='')
print()

def demo(n):
for i in range(n,1,-1):
control("*",i)

control("#")
demo(4)
4) What do you understand by keyword arguments? Explain with an example.

Written for

Institution
Course

Document information

Uploaded on
November 4, 2021
Number of pages
1
Written in
2021/2022
Type
Exam (elaborations)
Contains
Answers

Subjects

$5.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
Stevendurby

Also available in package deal

Get to know the seller

Seller avatar
Stevendurby Vellore Institute of Technlogy
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
6
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions