Write a Python program that reads from each line of an input file called grades.txt, a student id followed by the student grades in 3 exams. The program will then calculate the average of the student and save in a file called results.txt the student id followed by the calculated average. For example, if the grades.txt contains sii1 60 60 90 S222 89.5 90 89 S333 42 50 43 The file results.txt will contain sii1: 70.00 S222: 89.50 S333: 45.00

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter4: Control Structures I (selection)
Section: Chapter Questions
Problem 15PE: Write a program to implement the algorithm that you designed in Exercise 22 of Chapter 1. (Assume...
icon
Related questions
Question
Exercise 2: Name your program Lab12_ex1_Id.py
Write a Python program that reads from each line of an input file called grades.txt, a student id followed
by the student grades in 3 exams. The program will then calculate the average of the student and save in
a file called results.txt the student id followed by the calculated average. For example, if the grades.txt
contains
siii 60 60 90
S222 89.5 90 89
S333 42 50 43
The file results.txt will contain
siii: 70.00
S222: 89.50
S333: 45.00
Transcribed Image Text:Exercise 2: Name your program Lab12_ex1_Id.py Write a Python program that reads from each line of an input file called grades.txt, a student id followed by the student grades in 3 exams. The program will then calculate the average of the student and save in a file called results.txt the student id followed by the calculated average. For example, if the grades.txt contains siii 60 60 90 S222 89.5 90 89 S333 42 50 43 The file results.txt will contain siii: 70.00 S222: 89.50 S333: 45.00
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT