Question: Python, I need help with this code im writing. The last part that points to the highest number. its not working correctly, It just points
Python, I need help with this code im writing.
The last part that points to the highest number. its not working correctly, It just points to the largest number in the first character of the list
def readValues(): # to read in a series of floats by the user into a list.
my_list=[]
print("Please enter values, Q to quit")
while True:
numbers=input()
if numbers=='Q':
break
my_list.append(numbers)
return my_list
def findLargest(my_list): #- pass the list into the function and find largest
max_num=max(my_list)
return max_num
def display(my_list,max_num): # display the list and highlight the largest
print("Here are the numbers in the list")
location=my_list.index(max_num)
#print(my_list)
rows=len(my_list)
for r in range(rows):
if r!=location:
print(my_list[r])
if r==location:
print(my_list[r],sep='',end='')
print('
def main():
my_list=readValues()
max_num=findLargest(my_list)
display(my_list,max_num)
if __name__=="__main__":
main()


# Write a prog ram using list to read a sequence of values and prints them, and highlighting the largest number. 6 def readValues() : #_ to read in a series of floats by the user into a list. my_list-[ print("Please enter values, Q to quit") while True: numbers-input() if numbers'Q': 10 12 13 14 15 16 def findLargest(my-list): #-pass the list into the function and find largest 17 18 19 20 def display(my-list,max-num): #-display the list and highlight the largest 21 break my_list.append (numbers) return my_list max_num-max(my_listD return max num print ("Here are the numbers in the list" Location-my_list.index(max_num) #print (my-list) rows-len (my_list) for r in range(rows): 23 24 25 26 27 28 29 30 31 32 def main(): if r!-location: print(my_list[r]) if rlocation: print (my_list[r],sep,end-') print(' This is the largest number') my_list-readValues () max_num-findLargest(my_list) display(my_list,max_num) 34 35 36 37 if name 38 main main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
