Course Content
How to Add a Virtual Environment in Python
0/1
Set
0/1
Python
About Lesson

Assignment

1.Given a list of temperatures for 10 hours:
temp_list = [25, 30, 25, 35, 30, 25, 40, 35, 30, 25]

Write a function to find the positions and count of each temperature in the list.

2.Given a list of tuples, where each tuple contains the time (hour) and the temperature reading for that hour:
temp_list = [(1, 25), (2, 30), (3, 25), (4, 35), (5, 30), (6, 25), (7, 40), (8, 35), (9, 30), (10, 25)]

Write a function to find the times (positions) and the count of each temperature in the list. The result should be a list of tuples where each tuple contains:

  • The count of how many times that temperature occurred.
  • The temperature.
  • A list of the times when that temperature occurred.

3.Write a Python program for a “Jumble Game.” In this game:

  1. The program selects a random word from a predefined list.
  2. It then scrambles (jumbles) the letters of the chosen word.
  3. The program displays the jumbled word and prompts the user to guess the original word.

If the user guesses correctly, display a congratulatory message; if not, display the correct word.

4.Write a program to find the missing word form city names

For Example:-

S_rsa = Sirsa

Moh_li = Mohali

5.Create a Python program that simulates 5 overs (30 balls) of a cricket match. The program should:

Display the total runs and the counts of each type of run after all 30 balls.

  • Prompt the user to enter the runs scored on each ball (0 for dot balls, 1 for singles, 2 for doubles, 4 for fours, and 6 for sixes).
  • Keep track of: Total runs scored, Total number of ones, Total number of twos, Total number of fours, Total number of sixes, Total number of dot balls
  • Display the total runs and the counts of each type of run after all 30 balls.

6.Write a Python program that:

Takes a reference word (e.g., “Sirsa”) and three input words (e.g., “Sirsa”, “Sarsa”, “Srsa”).Compares each input word with the reference word to determine how many characters match between them. Calculates the percentage of matching characters based on the number of characters that are the same in both words, regardless of their positions. Displays the matching percentage for each input word compared to the reference word.