Write a program that takes a user's name as input and prints a greeting message. Ensure your program correctly handles any common syntax errors found in beginner's code that could prevent it from running.
Greetings Generator: Dodge the Bug!
Report a typo
Sample Input 1:
AliceSample Output 1:
Hello, Alice!Sample Input 2:
BobSample Output 2:
Hello, Bob!Write a program in Python 3
# Import necessary library for user input
import sys
def greet_user():
# Get the user's name from command line input
name = sys.argv[1]
# Print a greeting message
print(f"Hello, {name}!")
# Check if the script is the main entry point
if __name__ == '__main__':
greet_user()
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.