Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python 5. Write a function named longest name that reads names typed by the user and prints the longest name (the name that contains

using python

image text in transcribed

5. Write a function named longest name that reads names typed by the user and prints the longest name (the name that contains the most characters) in the format shown below. Your method should accept an integer n as a parameter and should then prompt for n names. The longest name should be printed with its first letter capitalized and all subsequent letters in lowercase, regardless of the capitalization the user used when typing in the name. If there is a tie for longest between two or more names, use the tied name that was typed earliest Also print a message saying that there was a tie, as in the right log below. It's possible that some shorter names will tie in length, such as ryan and TITO in the left log below; but don't print a message unless the tie is between the longest names.You may assume that n is at least 1, that each name is at least 1 character long and that the user will type single-word names consisting of only letters. The following table shows two sample calls and their output longest name(5) longest name(7) name #1? PeTer name #2? eric name #3? RAFAEL name #47 brian name #5? sarina name #67 LOR name #7? Ellillo Rafael's name is longest There was a tie!) Call Output | name #1? ryan name #2? TITO name #3? John name #4? 1AuRaLyN name #5? SuiaN Lauralyn's name is longest

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago