This Python program reads a string from the user and counts how many characters it contains.
The input is terminated when the user presses Enter, and the total character count is displayed.
Spaces and punctuation are included in the count.
# Read a string from user
text = input("Enter a string: ")
# Count characters
count = len(text)
# Display result
print("Number of characters:", count)
Enter a string: Hello, Shahin عزیز دلم
Number of characters: 23
- The input() function reads the full line until Enter is pressed
- len(text) calculates the total number of characters
- The result is printed using print()