write my assignment 3193

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()

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"

Comments are closed.

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp