filmov
tv
Using Python to Solve Java Problems | Solving Chapter 1 Exercise 13

Показать описание
Using Python to solve programming problems and exercises in DS Malik's book Java Programming - From Problem Analysis to Program Design.
In this video, I will tackle the first of the many programming exercises found in the book, particularly in Chapter 1 Exercise #13.
It's a simple programming exercise and takes only a few lines of codes in Python. The exercise requires to compute the weighted average of a student's scores from a series of data provided with the instructions. It also requires to design an algorithm. Although this exercise does not require to code and run using Python, I decided to do it anyways as an introduction to this video series.
The Problem
Design an algorithm to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format:
testScore1 weightTestScore1
...
For example, a sample data is as follows:
75 0.20
95 0.35
85 0.15
65 0.30
The Algorithm
1. Open file for reading
2. Get test score and weight from sample row of data
3. Multiply test score by weight and add the product to weighted average
4. If there is no more data do line 5 otherwise goto line 2
5. *Print the weighted average
6. Done
I hope you will learn from this video. If you have any suggestions, questions, or clarifications, please leave your comments below.
And don't forget to subscribe to get updated with the next videos in this series.
Music Credit: See You On The Otherside - The 126ers
#python #intermediate #programming #java #computerprogramming
In this video, I will tackle the first of the many programming exercises found in the book, particularly in Chapter 1 Exercise #13.
It's a simple programming exercise and takes only a few lines of codes in Python. The exercise requires to compute the weighted average of a student's scores from a series of data provided with the instructions. It also requires to design an algorithm. Although this exercise does not require to code and run using Python, I decided to do it anyways as an introduction to this video series.
The Problem
Design an algorithm to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format:
testScore1 weightTestScore1
...
For example, a sample data is as follows:
75 0.20
95 0.35
85 0.15
65 0.30
The Algorithm
1. Open file for reading
2. Get test score and weight from sample row of data
3. Multiply test score by weight and add the product to weighted average
4. If there is no more data do line 5 otherwise goto line 2
5. *Print the weighted average
6. Done
I hope you will learn from this video. If you have any suggestions, questions, or clarifications, please leave your comments below.
And don't forget to subscribe to get updated with the next videos in this series.
Music Credit: See You On The Otherside - The 126ers
#python #intermediate #programming #java #computerprogramming
Комментарии