Question: Please i need help using PYTHON for each one of these problems Problems: Triangle? Write a program that asks the user for three positive integers
Please i need help using PYTHON for each one of these problems
Problems:
Triangle?
Write a program that asks the user for three positive integers and then determines whether those integers could be the lengths of the sides of a triangle. This can be done by checking that the length of any side is not greater than the sum of the other two, if it is then they cannot form a triangle. Report the result ot the user.
Rolling Dice
Write a program that chooses two random numbers between 1 and 6 (like the roll of two dice) and then reports the roll to the user in the form: You rolled a 3 and a 5 for a total of 8
To generate random numbers, you will need to use a function from Python's 'random' module. This is not difficult, simply write import random as the first line of your Python file. You can then invoke the aptly named function random.randrange(start, stop) to generate random integers within a range (where 'start' and 'stop' are just numbers that you choose. Note that this function has a key similarity to the range(start, stop) function we learned about in class.
Time Since Midnight
Write a program that prompts the user for a number of seconds since midnight (positive integer). Report back to the user the number of days, hours, minutes, and seconds that correspond to the number of seconds they entered.
Rock, Paper, Scissors:
Play a round of rock paper scissors with the user. Ask them for their choice, have your program randomly make its choice and finally report the winner (either computer or user).
When validating the user's input, you may assume that the user will type in all lowercase or all uppercase (your choice), but not that they will always type a valid option.
Python's 'random' module provides a function to make a random choice from a list. To use it, import the random module as in the "Rolling Dice" problem and then call the function random.choice(list) where 'list' is your list of options.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
