To everyone who mentored me the past few day on this one lesson, thank you very much and I'll try to post the material the correct way from now on. (That's clicking the </> sign, then pasting my material)? I forget.
Well done russharold.
Would you mind sharing how you solved the "Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade" error?
I have the same code as you had when you had this message, and also have the same error.
I fixed the second error. I had named my students list something other than students. Once renamed to students it worked.
Great! Keep trucking!
There are three ways to retain the formatting of the code you wish to paste in the forum.
You can indeed paste your code, highlight it with your mouse and use the </> button, this will add 4 spaces in front of each line highlighted, thus creating a code block.
If you only want to do it for one or a few line, you can simply press
spacebar key on your keyboard 4 times in front of each line you wish to retain format .
Personlly, I find this third and last trick simpler, see which one you prefer
Whenever you would like to paste code, since this forum supports Markdown you can use three backticks before and after your code block like so:
my_var = 0
if x > my_var:
sum = my_var + x
and it will retain proper indentation and even have nifty syntax highlighting:
def my_func(x): my_var = 0 if x > my_var: sum = my_var + x else: print "Odelay!" return sum
I can't seem to highlight only a part of the code, is that normal? Everytime I try, the entire code would be highlighted.