Answered You can hire a professional tutor to get the answer.

QUESTION

Modify the largest.py program below to mark both the smallest and the largest elements ?

Modify the largest.py program below to mark both the smallest and the largest elements ?

# Create an empty list.

values = []

# Read the input values.

print("Please enter values, Q to quit:")

userInput = input("")

while userInput.upper() != "Q" :

  values.append(float(userInput))

  userInput = input("")

# Find the largest value.

largest = values[0]

for i in range(1, len(values)) :

  if values[i] > largest :

    largest = values[i]

# Print all values, marking the largest.

for element in values :

  print(element, end="")

  if element == largest :

    print(" <== largest value", end="")

print()

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question