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

Ex2 - Sequential Statements

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)
12 views2 pages

Ex2 - Sequential Statements

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

UGE2197 PROGRAMMING IN PYTHON LAB

Assignment 2: Problem solving using Sequential statements

Batch 2023-2027 Academic Year 2023-2024 ODD


Faculty: Dr. D. Thenmozhi, Dr. J. Bhuvana, Dr. V. Bala Subramanian, Dr. S. Dhannya, Ms. Nilu R. Salim,
Mr. Sakali Raghavendra Kumar

Learning Outcome:

● You will be able to apply computational thinking to devise solutions to the given
problems.
● You will be able to identify the type of statements (sequential, alternative and iterative)
required to solve problems.
● You code simple python programs to prompt the user input, to use variables and to
evaluate expressions.

Best Practices: Naming conventions to be followed.


Assignment :
Solve the following problems using Python (CO1, K3, 1.3.1, 13.3.1)
1. A bookstore needs to buy 60 copies of a book from a publisher. Suppose the cover price of
a book is ₹X, but bookstores get a discount of Y%. Shipping costs incurs ₹ Z for the first
copy and ₹ P for each additional copy. What is the total wholesale cost for 60 copies to be
paid by the bookstore to the publisher?
a. Identify the inputs required to solve the problem.
b. Identify the type of statements required.
c. Devise a solution and represent the same using flowchart and pseudocode.
d. Develop a program to print the wholesale cost of a single book and the wholesale
cost of 60 copies.

2. Assume the population of a city consists of X persons of different age groups. X includes
both male and female. Public welfare department wants to find the average age of male
and female. The department can obtain peoples date of birth from the corporation from
which the age can be calculated. (Note: Use only sequential statements to solve the
problem. Consider X to be less than or equal to 6)
a. Identify the inputs required to solve the problem.
b. Devise a solution and represent the same using flowchart and pseudocode.
c. Develop a program to compute the average age of male and female.
Additional problems using sequential statements for practice:

1. Swapping two numbers


2. Temperature conversion from Fahrenheit to Celsius (Hint: Fahrenheit = 9/5 x celsius + 32)
3. Compute radius of a circle for the given area.
4. Write a program to reverse a two-digit number and print its sum.
#Test Case 1: #Test Case 2:
Enter the two-digit number: 25 Enter the two-digit number: 70
The reverse of given number: 52 The reverse of given number: 07
The sum of digits:7 The sum of digits:7
5. Compute the gross and net salaries of an employee for the given basic pay (BP) based on
the allowances and deductions. Gross pay includes basic and all allowances, Net pay is the
difference between gross pay and deductions.
Allowances:
DA = 62% of BP
HRA = 8% of BP
Deductions:
Insurance = Rs. 2000
PF = 12% of BP
6. Read two complex numbers from the user and find their
a. sum
b. difference
c. product

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy