# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12730 | Variable Operation |
|
13849 | Score Calculation |
|
Description
Given 4 lines of text, you need to parse it and perform data operations to fit the requirement.
Hint
You may also need the function round()
to limit the digit numbers of float.
An example is shown below where 5.123456 is the original number and 1 (or 2) is the number of digits to preserve.
>>> print(round(5.123456, 1))
5.1
>>> print(round(5.123456, 2))
5.12
Input
4 lines of text with the following syntax:
e1
e2
e3
e4
where e1, ... , e4 represented 4 elements from given text.
Output
A line of text with the following operations:
e1 multiply e2 plus e4 multiply e3
Note that the details of the operations are:
- e1 multiply e2 should be numbered multiplication and round the multiplication to only first decimal
- e4 multiply e3 should be the string multiplication
- e1, e2, e3 are considered as numbers, while e4 is a word.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please help TAs to calculate the final score of students based on below grading policies.
The grading policies of this classroom
- Test 1: 40%
- Test 2: 60%
- Bonus Point(Based on your participation in the class, there's no limit of the bonus point)
Input
Multiple lines of score information, where each line is an answering record for a user account.
The format of each line is given as:
Student Name, Test Result of Test1, Test Result of Test 2, Bonus Point
Examples are shown below.
Jerry,1/2,3/3,10
The 1/2 of Test Result denotes correct_answers/total_questions for Test 1.
Note: The score of a student is calculated as the number of correct answer divided by the total number of test question!
Output
The score for each student should be output with the format:
Student_Name:Jerry,Final_Score:90.00
The scroe of Jerry is caculated as 1/2*40 (Test 1) + 3/3*60(Test 2) + 10(Bonus Point) = 90
Note that
- The order of the output score should follow the same order of the input.
- Before doing addition for each Test score. Each test score should be converted in 2 decimals first
- The Final score should also have 2 decimals.