B.lakshya11aip Pba-1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

IP PBA-1

B.lakshya
11a
Q1:Problem:
This is a Python Program to take in the marks of 5 subjects and display the
grade.
Problem Description
The program takes in the marks of 5 subjects and displays the grade
Input
Output
Enter marks of the first subject: 85
Enter marks of the second subject: 95
Enter marks of the third subject: 99
Enter marks of the fourth subject: 93
Enter marks of the fifth subject: 100

Q2. Program: To find sale price of an item with given cost and discount (5%)
Input same amount and calculate discount based on the amount and
Given discount rate in Python.
The discount rates are:
Amount Discount
0-5000 5%
5000-15000 12%
15000-25000 20%
above 25000 30%
Input
Output
Enter Sale Amount: 30000
Discount : 9000.0
Net Pay : 21000.0

Q3:
To calculate perimeter/circumference and area of shapes such as
triangle, rectangle, square and circle in python
Input
output
Q4. Python Program to Calculate Profit or Loss
input
output

Enter the Cost Price: 300

Enter the Selling Price: 450

Profit of 150.0

Enter the Cost Price: 500

Enter the Selling Price: 379

Loss of 121.0

Enter the Cost Price: 400

Enter the Selling Price: 400


Q5:To compute simple interest

input
Output
P = 10000

R = 5

T = 5

Output :2500.0
Q6. This Python program calculates an equated monthly installment(EMI)

input
output
Enter principal amount: 25000

Enter annual interest rate: 5

Enter number of months: 12

Monthly EMI = 2140.1870447116867


7Q.Write a program that returns the largest even number in the list of
integers. If there is no even number in the input, print "No even
element".
input
Output
List[1,2,3,4,5,6,7,8,9,0] it will print 2,4,6,8,0

list[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9] it will print 4,,2,6

Q9:Create a list of your choice show append and extend method list of numbers

input&output
10.Create a list of your choice perform following operations:
Deleting elements using remove(), pop() and clear() methods
remove(item): Removes specified item from list.
pop(index): Removes the element from the given index
Input & output
Q8:You have a list a = [1, 2, [3, 4], 5]. Now answer the following. Verify
your answers in Python Shell.
(a)What is the length of a? (f)What does a [-1 * len(a)] evaluate to?

=4 Output:- 1

(b)How many elements does it contain? What are their types?

=It contain 4 element. 3 integer type & 1 list.

©How many integers?

=3 integer

(d)What does len(a[2]) return?

(e)What does a[len(a)] evaluate to?

It gives error.

(f)
Thank
you:)

You might also like