Name Length
Write a program that allows a user to enter their first name. The program should then determine the length of the name and display the length for the user.
Enter your name: John Your name has 4 characters.
DECLARE name AS STRING DECLARE name_length AS INTEGER OUTPUT "Enter your name: " INPUT name SET name_length TO LENGTH(name) OUTPUT "Your name has " & name_length & " characters."
name = str(input("Enter your name: "))
name_length = len(name)
print("Your name has", name_length, "characters.")
# Get name from user
name = str(input("Enter your name: "))
# Calculate names length
name_length = len(name)
# Display the names length for the user
print("Your name has", name_length, "characters.")
Extension
Extend the program to also ask the the user for their surname and display the number of characters in both names.
Enter your name: John Enter your surname: Smith Your full name has 9 characters.