Answered step by step
Verified Expert Solution
Question
1 Approved Answer
12. Write a program which computes the absolute value of a user input number. If the user inputs -n the program should output n, if
12. Write a program which computes the absolute value of a user input number. If the user inputs -n the program should output n, if the user inputs n the program should output n. The program should not tolerste any bad inputs, such as non-numerical strings. 13. Roulette: write a program which prints the following: 'green' if the user inputs zero "blue' if the user inputs a positive number red' if the user inputs an odd number below 10 'pink if the user inputs an odd number above 80 'yellow' if the usere inputs an odd number between 10 and 80 14. Rewrite the following code so it only makes one comparison and does not use the "or" operator choice-input( Do you want to continue: ') if choicey or choiceY print( continue') substring com Otherwise, the function should return false. 15. Write a function that accepts a string as an argument and returns true if the argument ends with the 16. Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase. Convert the sentene to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example the string "StopAndSmellTheRoses." would be converted to "Stop and smell the roses." 17. If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Check for such numbers below 1000 18. Write a program that lets the user enter a string and displays the character that appears most frequently in the string along with the number of times this character appeared 19. Read the numbers from a user input file and output the average, minimum, and maximum numbers 20. Write a program that lets the user play the game of Rock, Psper, Scissors against the computer. The program should work as follows: . When the program begins, a random number in the range of 1 through 3 is generated If the number is 1, then the computer has chosen rock. If the number is 2, then the com- puter has chosen paper. If the number is 3, then the computer has chosen scissors. (Don't display the computer's choice yet.) . The user enters his or her choice of "rock," "paper" or "scissors" at the keyboard. . The computer's choice and the winner are displayed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started