Skip to content

Instantly share code, notes, and snippets.

@amazingsmash
Last active November 12, 2025 11:19
Show Gist options
  • Select an option

  • Save amazingsmash/6488a1d26ff7fc1df8d1524ac3e16ce3 to your computer and use it in GitHub Desktop.

Select an option

Save amazingsmash/6488a1d26ff7fc1df8d1524ac3e16ce3 to your computer and use it in GitHub Desktop.
# TEST GIST FOR THE SUBJECT HPI
# MIT License
#
# Copyright (c) 2024 José Miguel Santana Núñez
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Function to compute final scores based on theory and practical scores
from typing import List, Tuple
def compute_scores(theory_scores: List[Tuple[str, float]], practical_scores: List[Tuple[str, float]]) -> None:
"""
Compute and display final scores for students based on theory and practical grades.
Args:
theory_scores (List[Tuple[str, float]]):
A list of tuples where each tuple contains a student's name and their theory score.
Example: [("Alice", 7.5), ("Bob", 8.0)]
practical_scores (List[Tuple[str, float]]):
A list of tuples where each tuple contains a student's name and their practical score.
Example: [("Alice", 9.0), ("Bob", 7.5)]
Returns:
None: The function prints the final computed score for each student directly.
"""
for theory_student_record in theory_scores:
name = theory_student_record[0]
theory_score = theory_student_record[1]
for practical_score_record in practical_scores:
practical_name = practical_score_record[0]
if practical_name == name:
practical_score = practical_score_record[1]
final_score = 0.3 * theory_score + 0.7 * practical_score
print(f"The final score of {name} is {final_score}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment