How to use input to prompt a user in python
Added by Michael A.
Step 1
This function takes an optional parameter, which is the prompt message that will be displayed to the user. ** Show more…
Show all steps
Your feedback will help us improve your experience
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
PYTHON PROGRAM: Write a program with a loop that repeatedly reads a string as input, where the string is either "duck" or "goose". The loop terminates when "goose" is entered. After the loop, your code should print out the number of "duck" strings that were read. NOTE: When reading the input, do not display a prompt for the user. Use the input() function with no prompt string. Here is an example: bird = input()
Aarya B.
2.2 Write a program that uses input to prompt a user for their name and then welcomes them. Note that input will pop up a dialog box. Enter Sarah in the pop-up box when you are prompted so your output will match the desired output. Code I wrote: name = input('Enter your name:') print('Hello Sarah') I got the desired output, which is: Hello Sarah. The error message was that I actually had to prompt for the user's name. How do I do this? Desired output: Hello Sarah Programming language: Python Original sample code: # The code below almost works name = input("Enter your name") print("Howdy")
Supreeta N.
Write and test a Python script that reads in a character string and an integer and outputs the character string repeated the number of times given by the integer.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD