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

Programs

The document contains five Python programs demonstrating various functionalities. Program 1 calculates total marks for a student, Program 2 determines the type of triangle based on side lengths, Program 3 displays even numbers and their squares between 100 and 110, Program 4 splits a string into words, and Program 5 checks driving license eligibility based on age. Each program includes user input and output statements.

Uploaded by

ayyrajoo98
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)
4 views2 pages

Programs

The document contains five Python programs demonstrating various functionalities. Program 1 calculates total marks for a student, Program 2 determines the type of triangle based on side lengths, Program 3 displays even numbers and their squares between 100 and 110, Program 4 splits a string into words, and Program 5 checks driving license eligibility based on age. Each program includes user input and output statements.

Uploaded by

ayyrajoo98
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

Program 1:

To write a Python program to read the name and


marks of a student and display the total marks.
Program:
name = input("Enter student name: ")

m1 = int(input("Enter marks of subject 1: "))

m2 = int(input("Enter marks of subject 2: "))

m3 = int(input("Enter marks of subject 3: "))

total = m1 + m2 + m3

print("Student Name:", name)

print("Total Marks:", total)

Program 2: To write a Python program to input the


lengths of the three sides of a triangle and
determine whether it is an equilateral, isosceles,
or scalene triangle.
Program:
a = int(input("Enter first side: "))

b = int(input("Enter second side: "))

c = int(input("Enter third side: "))

if a == b and b == c:

print("It is an Equilateral Triangle")

elif a == b or b == c or a == c:

print("It is an Isosceles Triangle")

else:

print("It is a Scalene Triangle")


Program 3: To write a Python program to display
even numbers and their squares between 100 and
110.
Program:
for i in range(100, 111):

if i % 2 == 0:

print("Number:", i, "Square:", i * i)

Program 4: To write a Python program to read a


string, split it into a list of words, and display each
word.
Program:
text = input("Enter a string: ")

words = [Link]()

for word in words:

print(word)

Program 5: To write a Python program to check


whether a user is eligible for a driving license or
not.
Program:
age = int(input("Enter your age: "))
if age >= 18:
print("You are eligible for a driving license")
else:
print("You are not eligible for a driving license")

You might also like