



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab report submitted by two students of the Department of Electrical and Computer Engineering at COMSATS University Abbotabad. It contains two questions related to Python programming language. The first question requires the students to create a simple calculator using Anaconda navigator software, while the second question requires them to create a Python class to represent employees in an organization and calculate their salaries based on years of service. flowcharts, code snippets, and outputs for both questions, as well as discussions on the correctness and efficiency of the codes.
Typology: Study Guides, Projects, Research
1 / 7
This page cannot be seen from the preview
Don't miss anything!




We have to make a simple calculator in python programming language in which we can perform simple operations of addition, multiplication, division and subtraction using Anaconda navigator software. We have to follow different rules of these operations and use some conditional statements to achieve our required goal. Flow Chart:
Output :
This code snippet writes a given string to a file called "myfile.txt" and then reads the content back from the file. It calculates and prints the number of characters and words in the content accurately. However, the code attempts to count lines by checking for periods, which is incorrect. To count lines correctly, it should split the content by line breaks ("\n") and count the resulting segments. ------------------------------------------------------------------------------------
In our this question we have to make a class of employees in python in which we have to mention the name, employment number, year of joining and designation of employees. Then we have to add the record of 10 employees and then a function which will calculate the salary of employee by following formula salary=basic +5000*number of years in company.
In conclusion, we have learn the concepts, including function definition and usage, file I/O, string processing, and object-oriented programming principles. Each code addresses specific tasks or problems, illustrating different aspects of Python programming. However, the correctness and efficiency of these codes may need some improvements, as discussed in their respective discussions .