# A binary file named “TEST. dat” has some records of the structure [TestId, Subject, MaxMarks, ScoredMarks) Write a function in Python named DisplayAvgMarks(Sub) that will accept a subject as an argument and read the contents of TEST. dat. The function will calculate & display the Average of the ScoredMarks of the passed Subject on screen.

A binary file named “TEST.dat” has some records
of the structure [TestId, Subject, MaxMarks,
ScoredMarks] Write a function in Python named
DisplayAvgMarks(Sub) that will accept a subject
as an argument and read the contents of
TEST.dat. The function will calculate & display the
Average of the ScoredMarks of the passed
Subject on screen.

Contents

## Explanation

def SumSalary(Sub):
f = open(“ABC.dat”, “rb”)
c=0
s=0
while True:
try:
print(g)
if g==Sub:
s=s+g
c=c+1
except:
f.close()
print(“sum of salary”, s/c)
f.close()

Explanation:

binary file named “TEST.dat” has some records of the structure

[TestId, Subject, MaxMarks, ScoredMarks)

Write a function in Python named DisplayAvgMarks(Sub) that will accept a

subject as an argument and read the contents of TEST.dat. The function will

calculate & display the Average of the ScoredMarks of the passed Subject on

screen.

plzz ans fast

Thanks
Useless (6)

Explanation:

Thanks
Useless (2)

# Program make a simple calculator

# This function adds two numbers

return x + y

# This function subtracts two numbers

def subtract(x, y):

return x – y

# This function multiplies two numbers

def multiply(x, y):

return x * y

# This function divides two numbers

def divide(x, y):

return x / y

print(“Select operation.”)

print(“2.Subtract”)

print(“3.Multiply”)

print(“4.Divide”)

while True:

# Take input from the user

choice = input(“Enter choice(1/2/3/4): “)

# Check if choice is one of the four options

if choice in (‘1’, ‘2’, ‘3’, ‘4’):

num1 = float(input(“Enter first number: “))

num2 = float(input(“Enter second number: “))

if choice == ‘1’:

print(num1, “+”, num2, “=”, add(num1, num2))

elif choice == ‘2’:

print(num1, “-“, num2, “=”, subtract(num1, num2))

elif choice == ‘3’:

print(num1, “*”, num2, “=”, multiply(num1, num2))

elif choice == ‘4’:

print(num1, “/”, num2, “=”, divide(num1, num2))

break

else:

print(“Invalid Input”)

Thanks
Useless (2) Explanation:

thank Thanks
Useless (1)

Multiplication table (from 1 to 10) in Python

num = 9

# To take input from the user

# num = int(input(“Display multiplication table of? “))

# Iterate 10 times from i = 1 to 10

for i in range(1, 10):

print(num, ‘x’, i, ‘=’, num*i)

Output

9x 1 = 9

9 x 2 = 18

9x 3 = 27

9x 4 = 36

9x 5 = 45

9x 6 = 54

9x 7 = 63

9x 8 = 72

9x 9 = 81

9x 10 = 90

Thanks
Useless (1)

for i in range(0,101):

print(“\n”,i)

if(i%11==0):

print(“POP & NUMBER IS “, i) ;

Explanation:

HOPE IT HELPS YOU..

Thanks
Useless

print(“Python is a dynamic, high level, free open source and interpreted programming language. It supports object-oriented programming as well as procedural oriented programming. It is very easy to code in python language and anybody can learn python basics in a few hours or days. It is also a developer-friendly language.”)

Explanation:

Use this command to print any output

Thanks
Useless  