Knowee
Questions
Features
Study Tools

Write a function that reads your name in lowercase and perform the following operationprints it in uppercaseprints the length of the name

Question

Write a function that reads your name in lowercase and perform the following operations:

  1. Prints it in uppercase
  2. Prints the length of the name
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a Python function that fulfills your requirements. It reads a name in lowercase, prints it in uppercase, and also prints the length of the name.

def process_name():
    # Step 1: Read the name in lowercase
    name = input("Enter your name in lowercase: ").strip()
    
    # Step 2: Print the name in uppercase
    print("Name in uppercase:", name.upper())
    
    # Step 3: Print the length of the name
    print("Length of the name:", len(name))

# Call the function to execute
process_name()

Explanation:

  1. Input Handling: The function prompts the user to input their name in lowercase, using input(). The strip() method is used to remove any leading or trailing whitespace.
  2. Conversion to Uppercase: The upper() method converts the input name to uppercase letters.
  3. Length Calculation: The len() function calculates the length of the input name, returning the number of characters.

You can run this function in a Python environment. It will prompt you to enter your name, then display the name in uppercase along with its length.

This problem has been solved

Similar Questions

Write a program that takes a string of lowercase characters as input and prints it in uppercase, reversed.

Which function helps in changing the text to uppercase in Excel?Answer( Please choose a correct answer )   CLEARLOWER()CAPITAL()UPPER()BIG()

Question 6Given myvar = 'hello' , how would you return myvar as uppercase?1 pointlen(myvar)myvar.find('hello')myvar.upper()

Which of the following function will change the first letter of every word to Upper Case in excel? FirstUpper Tittle Proper Mid

Which of the following function converts a string to all uppercase?Aupper()Bisdecimal()Cswapcase()Dtitle()

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.