[go: up one dir, main page]

0% found this document useful (0 votes)
60 views2 pages

ABC 32343307 Sec Python Practical2021

The document provides instructions for a Python programming practical exam, including: 1. Creating a function to prompt the user for employee data, write it to a file, and display the file contents. 2. Creating functions to prompt for a list of numbers, display the list, calculate the factorials of the numbers and insert them into a dictionary with the numbers as keys and factorials as values, and display the dictionary. 3. The functions must be properly commented and the code and outputs compiled into a single PDF file with the required file name and submission details.

Uploaded by

soft ware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

ABC 32343307 Sec Python Practical2021

The document provides instructions for a Python programming practical exam, including: 1. Creating a function to prompt the user for employee data, write it to a file, and display the file contents. 2. Creating functions to prompt for a list of numbers, display the list, calculate the factorials of the numbers and insert them into a dictionary with the numbers as keys and factorials as values, and display the dictionary. 3. The functions must be properly commented and the code and outputs compiled into a single PDF file with the required file name and submission details.

Uploaded by

soft ware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ARYABHATTA COLLEGE - Practical Dec 2021

Course & Semester: B.Sc. (Hons.) Computer Science, Semester III


Unique Paper Code: 32343307
Paper Name: (SEC) Programming in Python Practical
Date: 13th December 2021
Duration: 4 hours
Upload the following latest by 1:30 pm today, 13th December 2021:

Give the code (of all files) & screenshots of the outputs in a single PDF file.

(If you do not have a PC/laptop handwrite the code/ pseudocode and handwrite
the outputs), take pictures and make a single PDF.)

CAREFULLY READ THE INSTRUCTIONS GIVEN BELOW

Instructions for the Candidate:

1. (Those that are handwriting the code) Attempt the questions (handwritten) on blank
A4 sheets. Give page number on each page of the answer sheet. After completing
your paper, make a single PDF of the answer sheets.
2. Ensure that the images are clear and readable.
3. Write your Course Name & Semester, Paper Code, your University Roll Number,
your Name and today’s Date, on the top of the 1st page
4. Rename the PDF file to SEC-Python-UnivRollNo-Name.pdf
(E.g. of file name: SEC-Python-21059570002-Neeraj.pdf)
5. Upload PDF in the Google Classroom > Classwork latest by 1:30 pm today, 13th
December 2021. Do not forget to click the ‘Turn in’/ ‘Mark as done’ button.
6. In case of any problem, or you were unable to upload your file, call the teacher.
ATTEMPT ALL QUESTIONS

Q1. Write a Python program (use function main() ) that does the following (and makes

calls to the specified functions):

a. Prompts user to input the number of employees, n, for whom data is to be input

b. Calls a function createEmpFile(n). This function does the following:

• For each of the n employees, inputs Employee First Name, Sex and

Department. Concatenates this data in a single string

• Writes this string into a file EmpData.txt

c. Calls a function displayEmpFile(‘EmpData.txt’) that reads data from the file (line

by line) and displays the contents of EmpData.txt, Sarika F Sales

Sample data of EmpData.txt, is shown: Sameer M HR

IMPORTANT: Comment the code

Q2. Write a Python program that does the following (and makes calls to the specified

functions):

a. Prompt user to input the number of numbers, x

b. Calls a function createList(x) which creates a list of x numbers input from the user.

This function returns myList

c. Writes appropriate text and displays the contents of list myList

d. Calls a function createDictionary(myList) which reads each element of myList

and inserts the factorial of this number into a dictionary dFactorial. This function

returns dFactorial.

[the {key: value} of the dictionary is the number and its factorial {n: n!}]

e. Writes appropriate text and displays dFactorial

IMPORTANT: Comment the code

*********

You might also like