Creating a Menu Driven Program to Perform Arithmetic Operations, Study Guides, Projects, Research of Computer science

A python program that creates a menu-driven program to perform basic arithmetic operations (+, -, *, /) based on the user's choice. The program allows the user to select an operation from a menu and then prompts for two numbers to perform the selected operation. The program then displays the result of the operation. The source code, sample outputs, and verification of the program's successful execution. This document could be useful for students learning python programming, particularly in the areas of control structures, functions, and basic arithmetic operations.

Typology: Study Guides, Projects, Research

2023/2024

Uploaded on 05/14/2024

mukthar-mj
mukthar-mj 🇮🇳

1 / 48

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
PEM SCHOOL OF EXCELLENCE
CBSE Affiliation No: 1930353
Kangayam Road, Tirupur 641 606
Name ………………………………………………………………………………………………………………………………………………………
Register No …………………………………………………………….. Year …………………………………………………………………..
School …………………………………………………………………………………………………………………………………………………….
This is Certified to be the bonafide work of the student in this Laboratory and submitted for the
practical examination held on ……………………………… at ………………………………………………………………………………..
……………………………………………..
Principal/H.M
…………………………………………......
Teacher in charge
……………………………………………..
Internal Examiner
…………………………………………......
External Examiner
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30

Partial preview of the text

Download Creating a Menu Driven Program to Perform Arithmetic Operations and more Study Guides, Projects, Research Computer science in PDF only on Docsity!

PEM SCHOOL OF EXCELLENCE

CBSE Affiliation No: 1930353 Kangayam Road, Tirupur – 641 606 Name ……………………………………………………………………………………………………………………………………………………… Register No …………………………………………………………….. Year ………………………………………………………………….. School ………………………………………………………………………………………………………………………………………………………. This is Certified to be the bonafide work of the student in this Laboratory and submitted for the practical examination held on ……………………………… at ……………………………………………………………………………….. …………………………………………….. Principal/H.M

Teacher in charge …………………………………………….. Internal Examiner

External Examiner

EXPT.NO (^) DATE CONTENTS PAGE NO TEACHER’S INITIAL 1 CREATING^ A^ MENU^ DRIVEN PROGRAM^ TO PERFORM ARITHMETIC OPERATIONS 2 CREATING^ A^ PYTHON^ PROGRAM^ TO^ DISPLAY^ FIBONACCI SERIES 3 CREATING^ A^ MENU^ DRIVEN^ PROGRAM^ TO^ FIND^ FACTORIAL AND SUM OF LIST OF NUMBERS USING FUNCTION 4 CREATING A PYTHON PROGRAM TO IMPLEMENT MATHEMATICAL FUNCTIONS 5 USER DEFINED FUNCTION WITH PARAMETERS (^6) COUNTING NUMBER OF WORDS IN DATA FILE 7 CREATING^ A^ PYTHON^ PROGRAM^ TO^ GENERATE^ RANDOM NUMBER BETWEEN 1 TO 6 8 CREATING^ A^ PYTHON^ PROGRAM^ TO^ READ^ A^ TEXT^ FILE^ LINE BY LINE AND DISPLAY EACH WORD SEPARATED BY '#' 9 CREATING A PYTHON PROGRAM TO READ A TEXT FILE AND DISPLAY THE NUMBER OF VOWELS/CONSONANTS/LOWER CASE/ UPPER CASE CHARACTERS 10 CREATING A PYTHON PROGRAM TO COPY PARTICULAR LINES OF A TEXT FILE INTO AN ANOTHER TEXT FILE 11 CREATING A PYTHON PROGRAM TO CREATE AND SEARCH RECORDS IN BINARY FILE 12 CREATING^ A^ PYTHON^ PROGRAM^ TO^ CREATE^ AND UPDATE/MODIFY RECORDS IN BINARY FILE 13 CREATING^ A^ PYTHON^ PROGRAM^ TO^ CREATE^ AND^ SEARCHI EMPLOYEE’S RECORD IN CSV FILE 14 CREATING^ A^ PYTHON^ PROGRAM^ TO^ IMPLEMENT^ STACK OPERATIONS

EX.NO: 1 DATE:

CREATING A MENU DRIVEN PROGRAM TO PERFORM ARITHMETIC

OPERATIONS

AIM:

To write a menu driven Python Program to perform Arithmetic operations (+,-*, /) based on the user’s choice. SOURCE CODE:

SAMPLE OUTPUT:

Python Program Executed Output: Run 1: RUN- 2 Result: Thus, the above Python program is executed successfully and the output is verified.

SAMPLE OUTPUT:

Python Executed Program Output: RUN - 1: RUN - 2 : Result: Thus, the above Python program is executed successfully and the output is verified.

EX.NO: 3 DATE:

CREATING A MENU DRIVEN PROGRAM TO FIND FACTORIAL AND SUM OF LIST OF

NUMBERS USING FUNCTION.

AIM:

To write a menu driven Python Program to find Factorial and sum of list of numbers using function. SOURCE CODE:

EX.NO: 4 DATE:

CREATING A PYTHON PROGRAM TO IMPLEMENT MATHEMATICAL FUNCTIONS

AIM:

To write a Python program to implement python mathematical functions to find: (i) To find Square of a Number. (ii) To^ find^ Log^ of^ a^ Number(i.e.^ Log 10 ) (iii) To find Quad of a Number SOURCE CODE:

SAMPLE OUTPUT:

Python Executed Program Output: Result: Thus, the above Python program is executed successfully and the output is verified.

EX.NO: 6 DATE:

COUNTING NUMBER OF WORDS IN DATA FILE

AIM:

Program to count number of words in data file data.txt SOURCE CODE: file1=open("data.txt","r") line=" " count= while line: line=file1.readline() s=line.split() for word in s: count+= print("Number of words=",count) file1.close() Given Input: Emerging technologies are technologies whose development, practical applications, or both are still largely unrealized. These technologies are generally new but also include older technologies finding new applications. Emerging technologies are often perceived as capable of changing the status quo. SAMPLE OUTPUT: Result: Thus, the above Python program is executed successfully and the output is verified.

EX.NO: 7 DATE:

CREATING A PYTHON PROGRAM TO GENERATE RANDOM NUMBER

BETWEEN 1 TO 6

AIM:

To write a Python program to generate random number between 1 to 6 to simulate the dice. SOURCE CODE: SAMPLE OUTPUT: Python Executed Output Program: Result: Thus, the above Python program is executed successfully and the output is verified

EX.NO: 9 DATE:

CREATING A PYTHON PROGRAM TO READ A TEXT FILE AND DISPLAY THE

NUMBER OF VOWELS/CONSONANTS/LOWER CASE/ UPPER CASE CHARACTERS.

AIM:

To write a Python Program to read a text file "Story.txt" and displays the number of Vowels/ Consonants/ Lowercase / Uppercase/characters in the file. SOURCE CODE:

SAMPLE OUTPUT:

Story.txt: Result: Thus, the above Python program is executed successfully and the output is verified.

Python Executed Program Output: New.txt: Result: Thus the above Python program is executed successfully and the output is verified.

EX.NO: 11 DATE:

CREATING A PYTHON PROGRAM TO CREATE AND SEARCH RECORDS IN

BINARY FILE

AIM:

To write a Python Program to Create a binary file with roll number and name. Search for a given roll number and display the name, if not found display appropriate message. SOURCE CODE: