subject

What is wrong with this piece of code? I am trying to create a list given specific strings and an input, then find the largest word and return/print it. def largest(words):

Length = 0
Word = ""

largest_word = ""
num_Words = len(words)

for x in range(0, num_Words, 1):
largest_word = words[x]
largest_length = len(largest_word)
if (largest_length >= Length):
largest_length = Length
largest_word = Word

return largest_word

user_pet = input("Enter a pet: ")
y = ["cat", "dog", "hamster", user_pet]
largest_petname = largest(y)
print(largest_petname)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Jackson, who works in the finance department of a company, is holding a seminar for other employees on how to file taxes. only three employees sign up to attend the seminar. which device can he use to share his presentation with a group of three employees?
Answers: 1
You know the right answer?
What is wrong with this piece of code? I am trying to create a list given specific strings and an in...
Questions
question
Social Studies, 05.09.2020 03:01
question
Mathematics, 05.09.2020 03:01
Questions on the website: 13722361