please write programs for these questions Part 1 1. Write a Python program that prompts the user for a series of integers and stores in a list only the values between 1-100, and displays the resulting list. 2. Write a Python program that prompts the user for a list of integers and stores them in a list. For all values that are greater than 100, the string 'over' should be stored instead. The program should display the resulting list. 3. Write a Python program that prompts the user to enter a list of names and stores them in a list. The program should display how many times the letter 'a' appears within the list.
please write programs for these questions
Part 1
1. Write a Python program that prompts the user for a series of integers and
stores in a list only the values between 1-100, and displays the resulting list.
2. Write a Python program that prompts the user for a list of integers and stores
them in a list. For all values that are greater than 100, the string 'over'
should be stored instead. The program should display the resulting list.
3. Write a Python program that prompts the user to enter a list of names and
stores them in a list. The program should display how many times the letter 'a'
appears within the list.
4. Write a program that accepts a comma separated sequence of words as input
and prints the words in a sequence after sorting them alphabetically.
Suppose the following input is supplied to the program:
without, hello, bag, world
Then, the output should be:
bag, hello, without, world
5. Write a Python program that prompts the user to enter integer values to
populate two lists, then print messages to determine the following:
(a) Whether the lists are of the same length.
(b) Whether the elements in each list sum to the same value.
(c) Whether there are any values that occur in both lists.
Part 2 (Optional)
1. Create a program that picks a winner for a contest or prize draw. The program
should prompt for the names of the entrants and their contact details (address,
mobile no etc.) until the user enters a blank string. Then select a winner at
random and print their details. This is showcased in the demo program called
coin_change included in last week’s sample code.
b) Add a text based menu to the program with two initial options:
Add Contestant or Quit with the relevant functions.
c) Add a menu option that allows users to view the current list of contests.
d) Add a menu option that allows users to delete contestants.
Part 3
1. Write a Python function called add_daily_temp that is given a (possibly
empty) dictionary meant to hold the average daily temperature for each day of
the week, a temperature value, and the day of the week for the recorded
temperature. The function should then add the temperature to the dictionary
only if it does not already contain a temperature for that day. The function
should return the resulting dictionary, whether it is updated or not.
2. Write a Python function named moderate_days that is given a dictionary
containing the average daily temperature for each of the days of a week and
returns a list of the days in which the average was between 70 and 79 degrees.
3. Write a Python function named get_daily_temps that prompts the user
for the average temperature for each day of the week and returns a dictionary
containing the information the user entered.
4. Write a Python function named get_weekend_average_temp that is
passed a dictionary of daily temperatures and returns the average temperature
over the weekend for the weekly temperatures given.
5. Write a Python function named add_vegetable that is passed a (possible
empty) set of vegetable names and raises a ValueError exception if the given
vegetable is already in the set, otherwise, add the vegetable and return a new set.
6. Write a Python function named num_vowels_consonants that is passed
a string containing letters, each of which may be in either upper or lower case
and returns how many vowels and consonants the string contains.
Part 4 (Optional)
Write a program that creates and stores student grades.
Your program should start by asking users whether they would like to add or
view stored grades. If the user selects the first option, they should be repeatedly
prompted for the names and module results (4CS001, 4CS015 and 4CI018) of
students until the users enters a blank string, storing the information in a
dictionary, before writing the data to a text file in JSON or CSV format.
If the user selects to view student grades, any data stored in the results file
should be read, loaded into a dictionary and presented to the user.
Make sure to validate all inputs and utilise exception handling to avoid crashes.
Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 3 images