0% found this document useful (0 votes)
16 views1 page

Python_practice2

Uploaded by

yofot74187
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)
16 views1 page

Python_practice2

Uploaded by

yofot74187
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/ 1

Python Practice Problems 2

1. WAP in python find the area of a right-angled triangle.

Sample Input
Enter the base of the triangle: 10
Enter the height of the triangle: 5
Sample Output
The area of the triangle with base 10.0 and height 5.0 is 25.00

2. Write a Python Program to accept the details of a student like name, roll number and
mark and display it.
Sample input: Enter the name: Anisha
Enter the roll number: 21
Enter the mark: 78
Sample output:
Name: Anisha
Roll No: 21
Mark: 78
3. Write a Python program to get the largest number from a list.
Sample input: 12, 3, 47, 10
Sample output: 47 is the largest number.
4. Write a python program to find the average of 5 numbers
5. Python program to insert a number to any position in a list (Get the number to be inserted
and position from the user)
6. Write a program to rename a key city to a location in the following dictionary.
sample_dict = { "name": "Kelly", "age":25, "salary": 8000, "city": "New york"}
7. Write a Python program to change Brad’s salary to 8500 in the following dictionary.
sample_dict = {
'emp1': {'name': 'Jhon', 'salary': 7500},
'emp2': {'name': 'Emma', 'salary': 8000},
'emp3': {'name': 'Brad', 'salary': 500}
}

You might also like