Greeting
Easy · rating 900 · Strings, Implementation
Read a single line containing a name. Print Hello, <name>!
For example, if the input is World, print Hello, World!
Editorial
Greeting is a first-program exercise in reading input and formatting output: read a name and print Hello, <name>!. It's all about string interpolation and getting the punctuation exactly right.
name = input()
print(f'Hello, {name}!')Complexity
Time: O(n). Space: O(n).
Related problems
- Reverse a String — Easy
- RGB to Hex Color — Easy
- Parse a Timestamp — Medium
- Caesar Cipher — Medium
- Roman to Integer — Medium
- Password Strength — Medium