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 nameSample Inputsanjay kumarSample OutputSANJAY KUMAR12

Question

Write a function that reads your name in lowercase and perform the following operationprints it in uppercaseprints the length of the nameSample Inputsanjay kumarSample OutputSANJAY KUMAR12

🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Sure, here is a Python function that does what you asked for:

def name_operation():
    # Read the name in lowercase
    name = input("Enter your name in lowercase: ")

    # Print the name in uppercase
    print(name.upper())

    # Print the length of the name
    print(len(name))

You can call this function using name_operation(). When you run this, it will ask you to enter your name in lowercase. After you enter your name, it will print your name in uppercase and the length of your name.

This problem has been solved

Solution 2

Here is a Python function that performs the operations you described:

def name_operations(name):
    # Convert the name to uppercase
    upper_name = name.upper()
    print(upper_name)
    
    # Print the length of the name
    name_length = len(name)
    print(name_length)

# Test the function
name_operations("sanjay kumar")

When you run this code with the input "sanjay kumar", it will print "SANJAY KUMAR" and "12". The function works by first using the upper method to convert the name to uppercase, then using the len function to calculate the length of the name.

This problem has been solved

Solution 3

Here is a Python function that performs the operations you described:

def name_operations(name):
    # Convert the name to uppercase
    uppercase_name = name.upper()
    print(uppercase_name)
    
    # Print the length of the name
    length_of_name = len(name)
    print(length_of_name)

# Test the function
name_operations("sanjay kumar")

When you run this function with the input "sanjay kumar", it will print "SANJAY KUMAR" and "12". The function works by first using the upper method of the string to convert it to uppercase, then using the len function to calculate the length of the string.

This problem has been solved

Solution 4

Here is a Python function that performs the operations you described:

def name_operations(name):
    # Convert the name to uppercase
    uppercase_name = name.upper()
    print(uppercase_name)
    
    # Print the length of the name
    name_length = len(name)
    print(name_length)

# Test the function
name_operations("sanjay kumar")

When you run this function with the input "sanjay kumar", it will print "SANJAY KUMAR" and "12". The function works by first using the upper method of the string to convert it to uppercase, then using the len function to calculate the length of the string.

This problem has been solved

Solution 5

Here is a Python function that performs the operations you described:

def name_operations(name):
    # Convert the name to uppercase
    uppercase_name = name.upper()
    print(uppercase_name)
    
    # Print the length of the name
    name_length = len(name)
    print(name_length)

# Test the function
name_operations("sanjay kumar")

When you run this code with the input "sanjay kumar", it will print "SANJAY KUMAR" and "12". The function works by first using the upper method to convert the name to uppercase, then using the len function to calculate the length of the name.

This problem has been solved

Solution 6

Sure, here is a Python function that performs the operations you described:

Similar Questions

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

Define a function name_operation(str1), with one string argument. In this function:a. Use upper() function to convert str1 into Uppercase letters, and assign value to variable upperStrb. Use lower() function to convert str1 into Lowercase letters, and assign value to variable lowerStrc. Use title() function to convert the first character of each word in str1 to Uppercase letter, and assign value to variable titleStr

The abbreviation should consist of the first character of the first name, followed by a dot and space, the first character of the middle name followed by a dot and space, and finally, the last name as is.Input format :The input consists of three strings, each representing the first name (fname), middle name (mname), and last name (lname) of a student.Each name is a sequence of non-space charactersOutput format :The output displays a single string representing the alphabetical abbreviation of the student's name.Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases will fall under the following constraints:The length of each name (fname, mname, lname) is at most 19 characters.The names consist only of alphabetical characters (a-z, A-Z).

Arun is learning C language. His first program is to print his name in the console with proper spacing and spelling. Help him to achieve the task.Input format :No console input.Output format :The output displays the name as follows: "My Name is Arun."

Complete the program below. It should:define a function thatasks the user for their first nameasks the user for their last namereturns "x y", where x is their first name and y is their last nameoutputs the result of the function

1/3

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.