alexmojaki / futurecoder

100% free and interactive Python course for beginners
https://futurecoder.io/
MIT License
1.31k stars 140 forks source link

TestingFunctions page is broken (intentional irony?) #272

Closed alexmojaki-bot closed 2 years ago

alexmojaki-bot commented 2 years ago

User Issue Email: tekemperor@gmail.com User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko/20100101 Firefox/95.0

The "TestingFunctions" page requires debug mode to advance steps. There was no clear requirement to complete the first step. Asking for help is irrelevant since nothing is requested. I tried copying/pasting the code in case I typed something wrong. No change. Next button does not exist. Subsequent steps also do not advance, even if the output is the same as described in the text after advancing with debug mode.

Redux state

```json {"book":{"error":null,"route":"main","previousRoute":"question","pageSlugsList":["IntroducingTheShell","NavigatingShellHistory","IntroducingStrings","AddingStrings","IntroducingVariables","UsingVariables","WritingPrograms","StoringCalculationsInVariables","IntroducingForLoops","Indentation","BasicForLoopExercises","BuildingUpStrings","BuildingUpStringsExercises","BasicTerminology","IntroducingIfStatements","CombiningCompoundStatements","UnderstandingProgramsWithSnoop","IfAndElse","TheEqualityOperator","IntroducingElif","OtherComparisonOperators","IntroducingLists","BuildingNewLists","UsingBreak","GettingElementsAtPosition","CallingFunctionsTerminology","FunctionsAndMethodsForLists","MoreListFunctionsAndMethods","StringMethodsUnderstandingMutation","HowToFindInformationWithGoogleAndMore","UnderstandingProgramsWithPythonTutor","EqualsVsIs","ModifyingWhileIterating","SingleAndDoubleQuotesInStrings","IntroducingFstrings","IntroducingNestedLoops","IntroducingBirdseye","IntroducingNestedLists","LoopingOverNestedLists","DefiningFunctions","CallingFunctionsWithinFunctions","ReturningValuesFromFunctions","TestingFunctions","MoreOnReturn","IntroducingOr","IntroducingAnd","MultiLineExpressions","CombiningAndAndOr","IntroducingNotPage","IntroducingTicTacToe","NewlinesAndFormatBoard","Types","InteractiveProgramsWithInput","NestedListAssignment","MakingTheBoard","TheFullTicTacToeGame"],"user":{"uid":"ZI02ZXYDupeL9yoQwJDMtKXaiJx2","email":null,"developerMode":true,"pageSlug":"TestingFunctions","pagesProgress":{"BasicForLoopExercises":{"step_name":"final_text"},"BuildingNewLists":{"step_name":"final_text"},"BuildingUpStrings":{"step_name":"final_text"},"BuildingUpStringsExercises":{"step_name":"final_text"},"CallingFunctionsTerminology":{"step_name":"final_text"},"CallingFunctionsWithinFunctions":{"step_name":"final_text"},"CombiningCompoundStatements":{"step_name":"final_text"},"DefiningFunctions":{"step_name":"final_text"},"EqualsVsIs":{"step_name":"final_text"},"FunctionsAndMethodsForLists":{"step_name":"final_text"},"GettingElementsAtPosition":{"step_name":"final_text"},"HowToFindInformationWithGoogleAndMore":{"step_name":"final_text"},"IfAndElse":{"step_name":"final_text"},"Indentation":{"step_name":"final_text"},"IntroducingBirdseye":{"step_name":"final_text"},"IntroducingElif":{"step_name":"final_text"},"IntroducingForLoops":{"step_name":"final_text"},"IntroducingFstrings":{"step_name":"final_text"},"IntroducingIfStatements":{"step_name":"final_text"},"IntroducingLists":{"step_name":"final_text"},"IntroducingNestedLists":{"step_name":"final_text"},"IntroducingNestedLoops":{"step_name":"final_text"},"LoopingOverNestedLists":{"step_name":"final_text"},"ModifyingWhileIterating":{"step_name":"final_text"},"MoreListFunctionsAndMethods":{"step_name":"final_text"},"OtherComparisonOperators":{"step_name":"final_text"},"ReturningValuesFromFunctions":{"step_name":"final_text"},"SingleAndDoubleQuotesInStrings":{"step_name":"final_text"},"StoringCalculationsInVariables":{"step_name":"final_text"},"StringMethodsUnderstandingMutation":{"step_name":"final_text"},"TheEqualityOperator":{"step_name":"final_text"},"UnderstandingProgramsWithPythonTutor":{"step_name":"final_text"},"UnderstandingProgramsWithSnoop":{"step_name":"final_text"},"UsingBreak":{"step_name":"final_text"},"WritingPrograms":{"step_name":"final_text"},"IntroducingTheShell":{"step_name":"first_expression"},"NavigatingShellHistory":{"step_name":"final_text"},"IntroducingStrings":{"step_name":"hello_string"},"AddingStrings":{"step_name":"hello_world_concat"},"IntroducingVariables":{"step_name":"word_assign"},"UsingVariables":{"step_name":"name_assign"},"BasicTerminology":{"step_name":"final_text"},"TestingFunctions":{"step_name":"surround_exercise"},"MoreOnReturn":{"step_name":"double_return_in_one_function"},"IntroducingOr":{"step_name":"InputAliceBob"},"IntroducingAnd":{"step_name":"TrueAndTrue"},"MultiLineExpressions":{"step_name":"invalid_multiline"},"CombiningAndAndOr":{"step_name":"CombiningAndOr"},"IntroducingNotPage":{"step_name":"IntroducingNot"},"IntroducingTicTacToe":{"step_name":"intro_row_winner"},"NewlinesAndFormatBoard":{"step_name":"one_way_to_print_board"},"Types":{"step_name":"five_different_types"},"InteractiveProgramsWithInput":{"step_name":"first_input"},"NestedListAssignment":{"step_name":"modify_list_in_function"},"MakingTheBoard":{"step_name":"naive_make_board"},"TheFullTicTacToeGame":{"step_name":"the_full_game"}}},"processing":false,"running":false,"numHints":0,"editorContent":"def assert_equal(actual, expected):\n if actual == expected:\n print(\"OK\")\n else:\n print(f\"Error! {repr(actual)} != {repr(expected)}\")\n\ndef double(x):\n return x * 2\n\ndef quadruple(x):\n return double(double(x))\n\n\nassert_equal(double(2), 4)\nassert_equal(double(5), 10)\nassert_equal(quadruple(2), 8)\nassert_equal(quadruple(5), 20)\n","messages":[],"pastMessages":["\n

\n

STOP!

\n

\n Try to avoid copy pasting code. You will learn, absorb, and remember better if you\n type in the code yourself.\n

\n

\n When copying is appropriate, there will be a button to click to make it easy.\n If there's no button, try typing.\n

\n

\n Having said that, we're not going to force you. Copy if you really want to.\n

\n
\n "],"requestingSolution":0,"prediction":{"choices":null,"answer":"","wrongAnswers":[],"userChoice":"","state":"hidden","codeResult":{}},"questionWizard":{"messages":["

Great! Here's some final tips:

\n
    \n
  • Make sure the output is showing the problem you have and not something else.
  • \n
  • Reduce your code to a minimal example. Remove any code that isn't directly related to the problem.
  • \n
  • Run your code through the Snoop, Birdseye, and Python Tutor debuggers to understand what it's doing.
  • \n
  • Search for your problem online.
  • \n
  • Read How do I ask a good question?
  • \n
\n

If you're really ready, copy and paste the below into the question website,\nand replace the first line with a description of your problem.

\n

You can still change your code or expected output and click Run again to regenerate the question.

\n
*Explain what you're trying to do and why*\n\nHere's my code:\n\n    def assert_equal(actual, expected):\n        if actual == expected:\n            print(\"OK\")\n        else:\n            print(f\"Error! {repr(actual)} != {repr(expected)}\")\n\n    def double(x):\n        return x * 2\n\n    def quadruple(x):\n        return double(double(x))\n\n\n    assert_equal(double(2), 4)\n    assert_equal(double(5), 10)\n\nThis is the result:\n\n    OK\n    OK\n\nThe expected output is:\n\n    abc 'abc'\n    5\n    10\n    OK\n    OK\n
"],"requestExpectedOutput":true,"expectedOutput":"abc 'abc'\n5\n10\nOK\nOK\n"}}} ```

alexmojaki commented 2 years ago

Will investigate more but I'm guessing they typed/copied in both blocks of code at the beginning so this was their full program:

def assert_equal(actual, expected):
    if actual == expected:
        print("OK")
    else:
        print(f"Error! {repr(actual)} != {repr(expected)}")

def double(x):
    return x * 2

assert_equal(double(2), 4)
assert_equal(double(5), 10)

But I didn't actually expect people to write assert_equal, it's provided for them. truncated_trees_match only knows how to ignore extra stuff after the expected program, maybe it should check each sublist of the body of the expected length.

This comes back to #94. It's really starting to feel like there should always be a lightbulb, even if there are no hints and the 'solution' seems obvious.

alexmojaki commented 2 years ago

But I didn't actually expect people to write assert_equal, it's provided for them. truncated_trees_match only knows how to ignore extra stuff after the expected program, maybe it should check each sublist of the body of the expected length.

A better solution to this would probably be to ignore the def assert_equal node.