ICT
Worksheet
Python programs
Date : 05-3-2024
Write the answer in your notebook.
In the Temperature Analysis game, players analyze the temperature changes. The
final score is determined by counting:
● Add 2 points for each increase in temperature.
● Subtract 1 point for each decrease in temperature.
Write Python code to calculate the final score at the end of a Temperature Analysis
game.
Input:
● Enter the number of times the temperature increased (I).
● Enter the number of times the temperature decreased (D)
I = int(input("Enter the number of times the temperature increased (I): "))
D = int(input("Enter the number of times the temperature decreased (D): "))
final_score = (2 * I) - D
print("Final Score:", final_score)
Question 2
User input a numeric grade, and the system determines whether the grade
represents a pass or fail based on the following rule:
● If the grade is 60 or above, it's considered a "Pass."
● Otherwise, it's categorized as a "Fail."
Write a Python code to determine and display whether the entered numeric
grade is a "Pass" or "Fail."
Input:
● Enter the numeric grade.
Output:
● Display whether the grade is a "Pass" or "Fail.
grade = float(input("Enter the numeric grade: "))
result = "Pass" if grade >= 60 else "Fail"
print("Result:", result)
Question 3 In a game, players earn points based on their performance. The scoring
rules are as follows:
● Add 3 points for each successful task completed.
● Subtract 1 point for each unsuccessful task.
Write Python code to calculate the final score at the end of the game based on the
user's input for the number of successful and unsuccessful tasks.
Input:
● Enter the number of successful tasks (S).
● Enter the number of unsuccessful tasks (U).
Output:
● Display the final score (F).
S = int(input("Enter the number of successful tasks (S): "))
U = int(input("Enter the number of unsuccessful tasks (U): "))
final_score = (3 * S) - U
print("Final Score:", final_score)