Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Python Program

Uploaded by

Suhan Haldar
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)
4 views

Python Program

Uploaded by

Suhan Haldar
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

PYTHON PROGRAM

1.Write a program in python two add two numbers through a


function.

CODE

OUTPUT
PYTHON PROGRAM
2.Write a program in python to calculate simple interest using a
function interest() that can receive principal amount, time and
rate and returns calculated simple interest. Do specify default
values for rate and time as 10% and 2 years respectively.

CODE

OUTPUT
PYTHON PROGRAM
3.Write a program in python that receives two numbers in a
function and returns the results of all arithmetic operations (+ , -
,* , / , % ) on these numbers.

CODE

OUTPUT
PYTHON PROGRAM
4.Write a program in python that generates 4 terms of an AP by
providing initial and step values to a function that returns first
four terms of the series.
CODE

OUTPUT
PYTHON PROGRAM
5.Write a python program to create a random number generator
that generates random numbers between 1 and 6 (simulates a
dice)

CODE

OUTPUT
PYTHON PROGRAM
6.Write a python program that inputs a real number and converts
it to the nearest integer using two different built-in-functions. It
also displays the given number rounded off to 3 places after
decimal.
CODE

OUTPUT
PYTHON PROGRAM
7.Write a python program that displays the size of a file after
removing EOL characters, leading and trailing white spaces and
blank lines.
FILE NAME

CODE

OUTPUT
PYTHON PROGRAM
8.Write a python program to display the number of lines in the
file.
CODE

OUTPUT

FILE NAME
PYTHON PROGRAM
9.Write a python program to display the size of file in bytes.
FILE SIZE

CODE AND OUTPUT


PYTHON PROGRAM
10.Write a python program of get roll numbers, names and marks
of the student of a class (get from user) and store these details in
a file called “Marks.txt”
CODE

OUTPUT

You might also like