Answered step by step
Verified Expert Solution
Link Copied!

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.

  1. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Networking A Top-Down Approach

Authors: James F. Kurose, Keith W. Ross

5th edition

136079679, 978-0136079675

More Books

Students also viewed these Computer Network questions

Question

Explain what are Infix, Prefix and Postfix Expressions?

Answered: 1 week ago

Question

please dont use chat gpt or other AI 5 5 5 .

Answered: 1 week ago