Wednesday, November 16, 2022

Strings and Variables 2 - Python Programming for Beginners Practice Exercise

Exercise 2:

Write a Python program that prompts the user for input and simply repeats what the user entered.

Sample Output:

Please type something and press enter: Hello there!
You entered:
Hello there!

Solution:

  1. #!/usr/bin/env python3
  2.  
  3. user_input = input('Please type something and press enter: ')
  4. print('You entered:')
  5. print(user_input)

No comments:

Post a Comment