Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i'm trying to find the biggest number in the list without using Max or Min function. But i dont know whats wrong with the code

image text in transcribed

i'm trying to find the biggest number in the list without using Max or Min function. But i dont know whats wrong with the code

det MyMax): a = None List:() b = int(input('How many numbers do you want to input')) for val in range(b): val = input('Please enter a value:') List().append(val) if float(List(val)) > float(a): a = List(val) print('The max is ' + a) Melax() bonus hw x C:\Users\92089 PycharmProjects untitled\venvScripts\python.exe "C:/Users/92089/Pychan How many numbers do you want to input Please enter a value: 2 Traceback (most recent call last): File "C:/Users/92089/PycharmProjects/HW/bonus hw.py", line 12, in MyMax) File "C:/Users/92089/PycharmProjects/HW/bonus hw.py", line 7, in MyMax List().append(val) Unbound LocalError: local variable 'list' referenced before assignment Process finished with exit code 1

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

More Books

Students also viewed these Databases questions