1.) Write a program that asks the user to enter a letter. Then it generates a random number between 1 and 10 and prints out the letter that many times. import random def print_letter_multiple_times(letter, times): print(letter * times) def output_fn(): user_letter = input("Enter a letter: ") if len(user_letter) == 1 and user_letter.isalpha(): random_number = random.randint(1, 10) print("Random number generated:", random_number) print_letter_multiple_times(user_letter, random_number) else: print("Invalid input. Please enter a single letter.") 2. Write a program that asks the user to enter a letter. Then it generates a random number between 1 and 10 and prints out the letter that many times. import random def roll_dice(): return [random.randint(1, 6) for _ in range(5)] def is_yahtzee(dice_values): return all(dice == dice_values[0] for dice in dice_values) def output_fn(): num_simulations = 10000 yahtzee_count = 0 for _ in range(num_simulations): dice_values = roll_dice() if is_yahtzee(dice_values): yahtzee_count += 1 percentage_yahtzee = (yahtzee_count / num_simulations) * 100 print("Percentage of Yahtzees:", percentage_yahtzee) 3.) def process_sentence(sentence): # Remove all spaces from the sentence sentence_without_spaces = sentence.replace(" ", "") # Convert the sentence to uppercase sentence_in_uppercase = sentence_without_spaces.upper() return sentence_in_uppercase def output_fn(): user_sentence = input("Enter a sentence: ") processed_sentence = process_sentence(user_sentence) print("Processed sentence:", processed_sentence) 4.) Write a program that asks the user to enter a string. If the string is at least five characters long, then create a new string that consists of the first five characters of the string along with three asterisks at the end. Otherwise add enough exclamation points (!) to the end of the string in order to get the length up to five. def process_string(user_string): if len(user_string) >= 5: # five characters long, create a new string # with the first five characters and three asterisks at the end. new_string = user_string[:5] + '***' else: # less than five characters long, add exclamation points # to the end of the string to make its length five. exclamation_count = 5 - len(user_string) new_string = user_string + '!' * exclamation_count return new_string def output_fn(): user_input = input("Enter a string: ") processed_string = process_string(user_input) print("Processed string:", processed_string) 5.) Write a program that ask the user to enter a string that consists of multiple words. Then print out the first letter of each word, all on the same line. def get_first_letters(input_string): words = input_string.split() first_letters = [word[0] for word in words] return "".join(first_letters) def output_fn(): user_input = input("Enter a string with multiple words: ") first_letters = get_first_letters(user_input) print("First letters:", first_letters)