Python Programming Lab Report, Study Guides, Projects, Research of Artificial Intelligence

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

2023/2024

Available from 10/29/2023

rehan-10
rehan-10 🇵🇰

6 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMSATS UNIVERSITY ABBOTABAD DEPARTMENT
OF
ELECTRICAL AND COMPUTER ENGINEERING
Submitted By:
NAME Registration
Zain ul abideen
FA21
-BCE-009
Huasnain Hafeeez
FA21
-BCE-036
Artificial Intelligence
Lab Report #: 2
Date: 2nd -Oct-2023
Course Instructor: Dr. Imran Shahzad
pf3
pf4
pf5

Partial preview of the text

Download Python Programming Lab Report and more Study Guides, Projects, Research Artificial Intelligence in PDF only on Docsity!

COMSATS UNIVERSITY ABBOTABAD DEPARTMENT

OF

ELECTRICAL AND COMPUTER ENGINEERING

Submitted By:

NAME Registration

Zain ul abideen FA21-BCE-^009

Huasnain Hafeeez FA21-BCE- 036

Artificial Intelligence

Lab Report #: 2

Date: 2 nd^ -Oct-

Course Instructor: Dr. Imran Shahzad

QUESTION NO 1:

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:

Code:

Output :

Code:

Output:

Discussion:

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. ------------------------------------------------------------------------------------

QUESTION NO 3:

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.

Flowchart:

Conclusion:

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 .