Page 118 - Touchpad_Plus_V3.2_Class 6
P. 118
Program 6: To calculate the average marks of three subjects.
Program6.py
File Edit Format Run Options Window Help
#Program to calculate the average marks of three subjects
sub1 = int (input ("Enter the marks of first subject: " ))
sub2 = int (input ("Enter the marks of second subject: " ))
sub3 = int (input ("Enter the marks of third subject: " ))
avg= (subl + sub2 + sub3)/3
print ("Average of marks is :" , avg)
Program 7: To calculate the volume and surface area of cylinder.
Program7.py
File Edit Format Run Options Window Help
#Program to calculate the volume and surface area of cylinder
pi = 22/7
radius = float (input ("Enter the radius of the cylinder: " ))
height = float (input ("Enter the height of the cylinder: " ))
volume = pi * radius * radius * height
total_surface_area= ((2 * pi * radius) * (radius + height))
print ("The volume of the cylinder is:" , volume)
print ("Surface area is :", total_surface_area)
Restart
Python is a popular high-level programming language.
Interactive Mode is a command line shell which gives immediate result for each command.
IDLE stands for Integrated Development and Learning Environment.
The input() function takes the user’s input while a program executes.
The print() function prints or sends the output to the standard output device, which is
usually a monitor.
Variables are memory reference points where we store values which can be accessed or
changed later.
A data type specifies the type of value a variable can contains.
Comments enable us to understand the way a program works.
116 Plus (Ver. 3.2)-VI

