Skip to content

Mannat1815/python_class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

python_class

Two Python Programs

This is a repository containing two Python programs.

Program 01 - Student Grade Calculation

This program calculates the percentage, grade, and division of a student based on their marks. The program prompts the user to enter the marks for five subjects, calculates the percentage, determines the grade and division based on the percentage, and displays the results.

How to Run

To run this program, save the code in a Python file and run it in the terminal or command prompt.

python program01.py

Example Output

Enter marks for subject 1: 78 Enter marks for subject 2: 86 Enter marks for subject 3: 92 Enter marks for subject 4: 67 Enter marks for subject 5: 55 marks:[78, 86, 92, 67, 55] percentage:75.6 grade:['C', 'B', 'A', 'D', 'E'] division:['II', 'I', 'I', 'III', 'III']

Program 02 - Rectangle Calculation

This program calculates the area and perimeter of a rectangle. The program defines a Rectangle class with attributes of length and breadth, and methods to get and set the attributes, calculate the area and perimeter, and display the attributes.

How to Run

To run this program, save the code in a Python file and run it in the terminal or command prompt.

python program02.py

Example Output

length:4 breadth:6 length:78 breadth:67 24 20 5206 290

Conclusion

These two programs demonstrate basic object-oriented programming concepts in Python. They are simple but effective examples that can be expanded upon for more complex programs.

About

Python classes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages