Remove First Character

Remove first character from string.

BeginnerPhase 5 - Category 4: String TransformationExample 4 of 10
remove-first-character.py
1# Take string input
2s = input("Enter a string: ")
3
4# Remove first character
5if len(s) > 0:
6 result = s[1:]
7 print(f"After removal: {result}")
8else:
9 print("String is empty")

Output

Enter a string: Hello
After removal: ello

What's going on

Use slicing to skip first character.

Key Concepts:

s[1:] skips first character
Returns substring
Check if string not empty