100% found this document useful (2 votes)
4K views10 pages

PPS - Practical - Assignment - 1 To 5 PDF

The document describes an assignment to calculate employee salary. It involves taking the basic pay as input, calculating HRA as 10% of basic pay, TA as 5% of basic pay, gross salary as the sum, deducting professional tax of 2% of gross salary, and displaying the net salary. The steps involve input, calculations, and output display. The objective is to learn about Python data types, identifiers, and literals.

Uploaded by

Athul Rajan
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
100% found this document useful (2 votes)
4K views10 pages

PPS - Practical - Assignment - 1 To 5 PDF

The document describes an assignment to calculate employee salary. It involves taking the basic pay as input, calculating HRA as 10% of basic pay, TA as 5% of basic pay, gross salary as the sum, deducting professional tax of 2% of gross salary, and displaying the net salary. The steps involve input, calculations, and output display. The objective is to learn about Python data types, identifiers, and literals.

Uploaded by

Athul Rajan
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/ 10

Assignment no: 1

Problem statement: To calculate salary of an employee given his basic pay (take as
input from user). Calculate gross salary of employee. Let hra be 10 % of basic pay
and ta be 5% of basic pay. Let employee pay professional tax as 2% of total salary.
Calculate net salary payable after deductions.

Objective: To read salary details as input from user and display the gross salary.

Required software/hardware: Lab computer,ubuntu,python 3 interpreter /anaconda


navigator.

Outcomes: Getting knowledge of data types, identifiers, literals used in python.

Theory:
1. Explain all data types with syntax and examples
2. Explain identifiers and list rule of identifiers with example
3. Explain literals with example

Algorithm:

Step1: Start
Step2: Variable initializations
Step3: Accept basic pay from user
Step4: If value of basic pay is negative then ask user to enter positive value for basic pay
step5: Compute salary as
Hra = (basic_pay/100)*10; ta = (basic_pay/100)*5;
Temp_salary = basic_pay + hra + ta; ptax = (temp_salary/100)*2
Salary = temp_salary - ptax;
Step6: Display salary
Step7: Stop

Flowchart:

Draw flowchart on blank page by pencil only.

Program:

Write down your own created and executed program code along with all possible
outputs which you have performed at practical session.
Conclusion:

By implementing this assignment we learn the concepts and use of data types,
identifiers, literals and built-in functions.
Assignment 2

Problem Statement: To accept N numbers from user. Compute and display


maximum in list, minimum in list, sum and average of numbers.

Objective: To read numbers and store them into a list using for loop.

Required Software/Hardware: Lab Computer,Ubuntu,Python 3 interpreter. /Anaconda


navigator

Outcomes: Getting Knowledge of looping structure

Theory:
1. Explain For Loop and While loop with examples and flowchart
2. Explain list built-in function with examples

Algorithm:

Step 1: Start

Step 2: Accept a value of ‘n’ from user.

Step 3: Accept ‘n’ numbers from user and store them in a list

Step 4: Initialize variables min = 9999, max=0, sum=0, avg=0

Step 5: For each element in a list, perform steps 6 to 8

Step 6: Check if element is less than min then assign min equal to the element

Step 7: Check if element is greater than max then assign max equal to the element

Step 8: Calculate sum= sum + element

Step 9: Calculate average = sum / n Step 10: Stop

Flowchart:

Draw flowchart on blank page by Pencil Only


Program:

Write down your own created and executed program code along with all possible
outputs which you have performed at Practical Session.

Conclusion:

By implementing this assignment we learn the concepts and use of looping control
structure and list built-in functions.
Assignment 3

Problem Statement: To accept student’s five courses marks and compute his/her
result. Student is passing if he/she scores marks equal to and above 40 in each course. If
student scores aggregate greater than 75%, then the grade is distinction. If aggregate is
>=60% and <50%, then the grade is first division. If aggregate is >=50%and <60%, then
the grade is second division. If aggregate is >=40% and <50%, then the grade is third
division.

Objective: To read five subjects marks and store them into list,find out the gradings using
conditional statement

Required Software/Hardware: Lab Computer,Ubuntu,Python 3 interpreter /Anaconda


navigator

Outcomes: Getting Knowledge of conditional statements

Theory:
1. Explain
a. If statement with example and flowchart
b. If…..else statement with example and flowchart
c. If….elif…..else statement with example and flowchart
d. Nested if statement with example and flowchart

Algorithm:

Step 1: Start
Step 2: Accept marks of subject 1 out of 100
Step 3: Check if subject1 marks <40, if yes go to step 4 otherwise go to step 5
Step 4: Display message “Fail” go to 27
Step 5: Accept marks of subject 2 out of 100
Step 6: Check if subject2 marks <40, if yes go to step 7 otherwise go to step 8
Step 7: Display message “Fail” go to 27
Step 8: Accept marks of subject 3 out of 100
Step 9: Check if subject3 marks <40, if yes go to step 10 otherwise go to step 11
Step 10: Display message “Fail” go to 27
Step 11: Accept marks of subject 4 out of 100
Step 12: Check if subject4 marks <40, if yes go to step 13 otherwise go to step 14
Step 13: Display message “Fail” go to 27
Step 14: Accept marks of subject 5 out of 100
Step 15: Check if subject 5 marks <40, if yes go to step 16 otherwise go to step 17
Step 16: Display message “Fail” go to 27
Step 17: Compute Total as subject 1 + subject 2 + subject 3 + subject 4 + subject 5

Step 18: Compute percentage as (Total marks / 500)* 100


Step 19: Check if percentage is greater than equal to 70, if yes go to step 20 otherwise go to
step 21
Step 20: Display message “Grade is distinction” go to 27
Step 21: Check if percentage is greater than equal to 60 and less than 75, if yes go to step 22
otherwise go to step 23
Step 22: Display message “Grade is first class” go to 27
Step 23: Check if percentage is greater than equal to 50 and less than 60, if yes go to step 24
otherwise go to step 25
Step 24: Display message “Grade is second class” go to 27
Step 25: Check if percentage is greater than equal to 40 and less than 50, if yes go to step 26
otherwise go to step 27
Step 26: Display message “Grade is third class”
Step 27: Stop

Flowchart:

Draw flowchart on blank page by Pencil Only.

Program:

Write down your own created and executed program code along with all possible
outputs which you have performed at Practical Session.

Conclusion:

By implementing this assignment we learn the concepts and use of conditional


statements of python.
Assignment No.4

Problem Statement: To accept the number and Compute a) square


root of number, b) Square of Number, c) Cube of Number d) check for
prime, e) factorial of number, f) Prime Factors

Objective: To read an integer numbers and perform operation on it by


using function and modules

Required Software/Hardware: Lab Computer,Ubuntu,Python 3


interpreter /Anaconda navigator

Outcomes: Getting Knowledge of function and modules

Theory:
1. Explain function with example
2. Explain modules with examples
3. Explain Packages and use of it
4. Explain built-in packages(sys , IO)

Algorithms:

Step 1: Start

Step 2: Accept input Number

Step 3: Accept the user’s choice (1/2/3/4/5) and accordingly it will execute operations

Step 4: Check root of number

Step 5: Square of number

Step 6: Cube of number

Step 7: Check for Prime Number

Step 8: Check for Factorial of given number

Step 9: Check for prime factors for number.

Step 10: Print Output

Step 11: End


Flowchart:

Draw flowchart on blank page by Pencil Only.

Program:

Write down your own created and executed program code along with all possible
outputs which you have performed at Practical Session.

Conclusion:

By implementing this assignment we learn the concepts and use of functions,


modules and packages.
Assignment 5

Problem Statement: To check whether input number is Armstrong number or not.

Objective: To read number, extract individual digit from it and check number
is Armstrong or not

Required Software/Hardware: Lab Computer,Ubuntu,Python 3 interpreter


/Anaconda navigator

Outcomes: Getting Knowledge of number separation using string and list


concept

Theory:
1. Explain String with example
2. Explain
a. Concatenation (+) ,
b. Append (+=),
c. Repetition (*) Operators,
d. Slice (:) Operation
3. Explain string and iteration of string using loop

Algorithm:

Step 1: Start

Step 2: Accept a number from user

Step 3: sum =0

Step 4: For each digit in the number repeat steps 5 and 6

Step 5: Calculate cube = cube of the digit

Step 6: Calculate sum = sum + cube

Step 7: Check if sum is equal to the number entered by user if yes go to step 8

otherwise go to step 9

Step 8: Display message “Number is a Armstrong number” and go to step 10

Step 9: Display message “Number is not a Armstrong number”

Step 10: Stop


Flowchart:

Draw flowchart on blank page by Pencil Only.

Program:

Write down your own created and executed program code along with all possible
outputs which you have performed at Practical Session.

Conclusion:

By implementing this assignment we learn the concepts and use of string.

You might also like