Question

Use PYTHON3 to create a program that asks the user for their name, and then prints...

Use PYTHON3 to create a program that asks the user for their name, and then prints their initials. You must create a function called getInitials() that takes the name string and prints out the initials. It must be case insensitive and the initials must be printed in upper case. The program must contain a main() and a function called getInitials(), implemented as described in the function header comment given below. (You should include this function header comment in your own code.) ###########################################################

# getInitials() counts the instances of a letter in a string

# Input: name; a string containing the name of the user

# Output: None

PLEASE USE MEANINGFUL VARIABLES AND DON'T USE FOR LOOP OR BREAK..

0 0
Add a comment Improve this question Transcribed image text
Answer #1
###########################################################
# getInitials() counts the instances of a letter in a string
# Input: name; a string containing the name of the user
# Output: None
def getInitials(name):
    words = name.split()
    i = 0
    while i < len(words):
        print(words[i][0].upper(), end='')
        i += 1
    print()


def main():
    name = input("Enter name: ")
    print("Initials are: ")
    getInitials(name)


if __name__ == '__main__':
    main()
Add a comment
Know the answer?
Add Answer to:
Use PYTHON3 to create a program that asks the user for their name, and then prints...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that asks for 'name from the user and then asks for a number...

    Write a program that asks for 'name from the user and then asks for a number and stores the two in a dictionary [called the_dicr) as key-value pair. The program then asks if the user wants to enter more data [More data ly/n]?) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list Note: Ignore the case where the name is already...

  • In a file called First SecondNext.java, write a program that: • Asks the user to enter...

    In a file called First SecondNext.java, write a program that: • Asks the user to enter a string that contains at least five letters. It is OK if your program crashes when the user enters a string with length less than 5. • Stores that string in a variable called s. • Creates a variable called "first", and sets it equal to the first letter of s. • Creates a variable called "second", and sets it equal to the second...

  • Objectives: Use strings and string library functions. Write a program that asks the user to enter...

    Objectives: Use strings and string library functions. Write a program that asks the user to enter a string and output the string in all uppercase letters. The program should then display the number of white space characters in the string. You program should run continuously until the user enters an empty string. The program must use the following two functions: A function called count_spaces that counts the number of white spaces inside a string. int count_space(char str[]); which tell you...

  • Write a C Program that asks the user to input a string and then the user...

    Write a C Program that asks the user to input a string and then the user is prompted back whether the input string is a “Palindrome Word” or not. (A Palindrome Word reads the same backward or forward, eg. madam, racecar, etc.) Your program should contain a function that accepts the input string from the main function and returns a value indicating whether the input string is a Palindrome or not. Use Pointers to traverse the string.

  • Python code. No use of def() or return. 7a)Create a program that asks the user for...

    Python code. No use of def() or return. 7a)Create a program that asks the user for their full name (first, middle, and last). You can assume that compound names, such as Jamie-Lynn are joined by a hyphen, that names are separated by a space and that the user enters their data in the correct format. The program should then separate the first name, middle name, and last name from the single string entered by the user and save each piece...

  • need a program written in C++ that asks, with breaks, the user for their name (character...

    need a program written in C++ that asks, with breaks, the user for their name (character sequence) age (integer) gender (as a character) address (as a sentence) and then the program clears the inputs then prints the information to the user formating must has some aesthetical appeal

  • Write a program in java that asks a user for a file name and prints the...

    Write a program in java that asks a user for a file name and prints the number of characters, words (separated by whitespace), and lines in that file. Then, it replaces each line of the file with its reverse. For example, if the file contains the following lines (Test1.txt): This is a test Hi there Output on the console: Number of characters: 22 Number of words: 6 Number of lines: 2 Data written to the file (Test1.txt): tset a si...

  • PYTHON Write a function called hourly_employee_input that asks the user for a name (string), hours worked...

    PYTHON Write a function called hourly_employee_input that asks the user for a name (string), hours worked (int) and an hourly pay rate (float) and prints a string including the information. Call the function, entering expected values, numbers in appropriate range Call the function, entering negative numbers Call the function, entering bad input (letters, symbols) What do you need to add to your function for bad input? Handle the bad input so your program doesn't end when receiving bad input

  • Write a Java program which takes a string as a user input. Create 2 functions. The...

    Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console. The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string....

  • You are to write a program (BookExceptionsDemo.java) that will create and, using user input, populate an...

    You are to write a program (BookExceptionsDemo.java) that will create and, using user input, populate an array of instances of the class Book. The class Book is loaded in our Canvas files: Book.java The user will enter a number n (n must be > 0, trap the user until they input a valid value for n), Your program will declare and create an array of size n of instances of the class Book. The user will be asked to enter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT