0% found this document useful (0 votes)
7 views2 pages

Practical File Sample

The document provides code to input a student's name and marks in three subjects, calculate the total and percentage, and output the results. The code uses variables like name and marks[], functions like append(), sum(), upper(), and round() to process the input, calculations, and output.

Uploaded by

hemlatageography
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Practical File Sample

The document provides code to input a student's name and marks in three subjects, calculate the total and percentage, and output the results. The code uses variables like name and marks[], functions like append(), sum(), upper(), and round() to process the input, calculations, and output.

Uploaded by

hemlatageography
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PRACTICAL – 1

AIM:
Write a program to input name and marks in three subject to print name along with the
total and percentage.

CODING:
# Write a program to input name and marks in three subject to print name along with the
#total and percentage.

name=input('Enter your name :')


#Assuming that MM is 100
marks=[]

for i in range(3):
msg='Enter marks in subject #'+str(i+1)+' :'
m=int(input(msg))
marks.append(m)

print('-'*50)
print('Your name is :',name.upper())
print('Total is :',sum(marks))
print('Percentage is :',round(sum(marks)/len(marks),2))
print('-'*50)

OUTPUT OF THE CODE:


Enter your name :krishna singh
Enter marks in subject #1 :65
Enter marks in subject #2 :85
Enter marks in subject #3 :94
--------------------------------------------------
Your name is : KRISHNA SINGH
Total is : 244
Percentage is : 81.33
--------------------------------------------------

or you may paste screenshot of the output


VARIABLE AND FUNCTION USED:
Sno Variable / Function Name Datatype Purpose
1 name String To store name of the student
2 marks[] List To store marks in three subjects
3 i Integer To run a loop
4 append() A function to add element in a list
5 sum() A function to return sum of a list
6 upper() A function to print string in uppercase
7 round() A function to roundoff the value

You might also like