Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Sequences Sequence Operations Finding len, min, max

having problem with my python sequence

i need help with this codes please guys help, I have been stuck here for so long..

len_min_max.py
student_gpas = [4.0, 2.3, 3.5, 3.7, 3.9, 2.8, 1.5, 4.0]
length = len(student_gpas)
 min(student_gpas)
max(student_gpas)
print(student_gpas)

6 Answers

Since you completed task 1, task 2 and 3 should be straightforward as they are very similar. For these tasks you are missing the requested variable assignments.

can you show me the sample please?

Ines Fazlić
seal-mask
.a{fill-rule:evenodd;}techdegree
Ines Fazlić
Python Web Development Techdegree Student 9,569 Points

what Kris means is that as you were asked in first task to find lenght of student_gpas and ASSIGN it to a VARIABLE called LENGTH..so you did length = len(student_gpas) which was correct. In next steps you are asked to find max and min and asign it to variables named max_gpas and min_gpas. you got the code right but didnt asign them names like you did with LENGTH=. and print line is not needed. Hope this helps. Happy coding :)

please can you at the line this process for me one by one? please, I think this is the only way for me to unlock this issue. please help me...

length = len(student_gpas) max_gpas(student_gpas) min_gpas(student_gpas) print(student_gpas)

Is this the proper way to do it?

As you said, I did everything right so what is it that I havent done right?

you got the code right but didn't assign them names like you did with LENGTH=. and the print line is not needed. Hope this helps. Happy coding :)

please, can you analyze a better way to run the code, bit by bit for me, please? Can you please complete the sequence for me that is not properly aligned? Please....!!

Ines Fazlić
seal-mask
.a{fill-rule:evenodd;}techdegree
Ines Fazlić
Python Web Development Techdegree Student 9,569 Points

variable is a name that points to particular pieces of data. It is a label. Your first line of code is correct because you assigned it a name(variable) as requested. so length = len(student_gpas) . length here is a variable name. The next two tasks are the same format. it asks you to find max num in student_gpas,which you did with max(student_gpas).that was correct too. Then it askes you asign it a variable name max_gpas; so max_gpas = max(student_gpas). that is it. the same process you did for length. the same process for the next task which is to find min. you asign variable names to data so you can easily retrieve them later by calling them by name you asigned them. An advice for solving these challenges is to always read the task carefully. the answer is always mostly in them. Just follow it.

this are the errors that i have received..! Task #1

.

Ran 1 test in 0.000s

OK

E

ERROR: test_expected_output (main.TestLenExecution)

Traceback (most recent call last): File "", line 19, in test_expected_output File "/workdir/utils/challenge.py", line 24, in execute_source exec(src) File "", line 3 max_gpas = max(student_gpas) ^ IndentationError: unexpected indent


Ran 1 test in 0.000s

FAILED (errors=1) Task #2

.

Ran 1 test in 0.000s

OK

E

ERROR: test_expected_output (main.TestLenExecution)

Traceback (most recent call last): File "", line 19, in test_expected_output File "/workdir/utils/challenge.py", line 24, in execute_source exec(src) File "", line 3 max_gpas = max(student_gpas) ^ IndentationError: unexpected indent


Ran 1 test in 0.000s

FAILED (errors=1)

.

Ran 1 test in 0.000s

OK

E

ERROR: test_expected_output (main.TestMaxExecution)

Traceback (most recent call last): File "", line 19, in test_expected_output File "/workdir/utils/challenge.py", line 24, in execute_source exec(src) File "", line 3 max_gpas = max(student_gpas) ^ IndentationError: unexpected indent


Ran 1 test in 0.000s

FAILED (errors=1)

Ines Fazlić
seal-mask
.a{fill-rule:evenodd;}techdegree
Ines Fazlić
Python Web Development Techdegree Student 9,569 Points

remove the spaces before min and max.they should be at the same level as the first one. things like that matter in writing code