Sunteți pe pagina 1din 3

Python Programming Lab: Practice programs

1. A Simple First Python Program that displays “Hello World”.


2. A Python script to calculate area, diameter and circumference of a Circle.
3. Python script to calculate area, circumference of a Triangle/Rectangle.
4. Create a program that asks the user to enter their name and their age. Print out a
message addressed to them that tells them the year that they will turn 100 years
old.
5. Python script to convert a given number (in seconds) to hours, minutes and
seconds.

6. Write a program that calculates the number of US dollars equivalent to a given


number of Euros. Assume an exchange rate of 0.781162 Euros per dollar.
7. Write a python program to find out largest among three numbers. ( if , elif and
else statements).
8. Write a python program to check whether number is prime or not with while and
if statements.
i) Product
ii) Display prime numbers in between given range m and n
9. A Python script for rolling a dice and deciding the winner.
10.
Write a python program to calculate the EMI (Equatted Monthly Installment),
given the loan amount, the interest rate and time in months. The output should
be rounded to one decimal as shown below.
Input (int, double, Output (double)
int)
20000, 10.5, 60 429.9

250000, 12.5, 180 3081.3

500000, 7.5, 240 4028.0

10000, 10, 24 461.4

1575, 15.6, 24 76.8

7500000, 13.75, 173541.3


60

0, 1, 12 null
EMI = [P x R x (1+R)^N]/[(1+R)^N-1], where P stands for the loan amount or
principal, R is the interest rate per month [if the interest rate per annum is 11%,
then the rate of interest will be 11/(12 x 100)], and N is the number of monthly
installments.

11.Python script to calculate discount of the product with tax.


12.Python program to find out duplicate number between 1 to N numbers.
You have got a range of numbers between 1 to N, where one of the numbers is
repeated. You need to write a program to find out the duplicate number.
13.Python program to find out middle index where sum of both ends are equal.
14.Write a program to convert decimal number to binary format.
15.Write a program to find perfect number or not.
16.Write a program to find out duplicate characters in a string.
17.Write a program to find top two maximum numbers in a array.
18.Write a program to find the given number is Armstrong number or not?
19.Write a program to convert binary to decimal number.
20.Python programs to implement all types of sorting techniques.
21.Python program to get distinct elements from an array by avoiding duplicate
elements.
22.Write a program to remove duplicates from sorted array.
23.Python program for a given string S of length N find longest substring without
repeating characters.
24.A python program for having a bag containing numbers 1, 2, 3… 100. Each
number appears exactly once, so there are 100 numbers. Now one number is
randomly picked out of the bag. Find the missing number.

S-ar putea să vă placă și