0% found this document useful (0 votes)
28 views4 pages

Kibirshan Codings

Uploaded by

mhmdmfsr07
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)
28 views4 pages

Kibirshan Codings

Uploaded by

mhmdmfsr07
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/ 4

01.

# Basic Calculations

# Calculator Program in Python by using input() and format() functions

#Promting input from the user

n1 = float(input("Enter the First Number: "))

n2 = float(input("Enter the Second Number: "))

#addition

print("{} + {} = ".format(n1, n2))

print(n1 + n2)

#subtraction

print("{} - {} = ".format(n1, n2))

print(n1 - n2)

#multiplication

print("{} * {} = ".format(n1, n2))

print(n1 * n2)

#division

print("{} / {} = ".format(n1, n2))

print(n1 / n2)

Output :
02.

# Create empty lists to store student details

names = []

math_marks = []

english_marks = []

it_marks = []

totals = []

averages = []

# Process student data

for student in test_data:

# Get student details from test data

name = student[0]

math = student[1]

english = student[2]

it = student[3]

# Store in lists

names.append(name)

math_marks.append(math)

english_marks.append(english)

it_marks.append(it)

# Calculate and store total and average

total = math + english + it

average = total / 3

totals.append(total)

averages.append(average)
# Display results

print("\n--- Student Details ---")

print("Name\t\tMath\tEnglish\tIT\tTotal\tAverage")

print("-" * 50)

for i in range(10):

print(f"{names[i]}\t\t{math_marks[i]}\t{english_marks[i]}\t{it_marks[i]}\t{totals[i]}\t{averages[i]:.1f}")

# Display class averages

print("\n--- Class Averages ---")

print(f"Math Average: {sum(math_marks)/len(math_marks):.1f}")

print(f"English Average: {sum(english_marks)/len(english_marks):.1f}")

print(f"IT Average: {sum(it_marks)/len(it_marks):.1f}")

*Sample datas = [ Output :

["John", 85, 90, 88],

["Emma", 92, 88, 95],

["Mike", 78, 85, 80],

["Sarah", 95, 92, 91],

["Tom", 88, 84, 89],

["Lisa", 90, 91, 87],

["David", 82, 88, 85],

["Anna", 94, 89, 92],

["James", 87, 83, 86],

["Mary", 91, 90, 88]

]
03.

print("--- Student Details ---")

print("Name\t\tMath\tEnglish\tIT\tTotal")

print("-" * 50)

highest_total = 0

topper_name = ""

# Display all students and find topper

for student in students:

name = student[0]

math = student[1]

english = student[2]

it = student[3]

total = math + english + it

print(f"{name}\t\t{math}\t{english}\t{it}\t{total}")

# Check if this student has highest marks

if total > highest_total:

highest_total = total

topper_name = name

Output :

print("\n=== First Rank ===")

print(f"Name: {topper_name}")

print(f"Total Marks: {highest_total}")

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy