Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Prompt the user with a question, e.g. What is your favourite number from 0-9?, Save the user selection into a variable, e.g. b=input(What is your
Prompt the user with a question, e.g. "What is your favourite number from 0-9?", Save the user selection into a variable, e.g. b=input("What is your favourite number from 0-9?").
It's that simple. Did you notice input function? Here is another example. Write the code in a new file and display YOUR name.
- Write a Python program that will accept the base and height of a triangle from the user (use input( ) function ) and computes the area (area= 1/2 * b * h).
Hint: Below are two ways of doing it
print('Enter the triangle base:') b =input()
b =input('Enter the triangle base:')
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