Skip to main content
7 events
when toggle format what by license comment
Apr 20, 2022 at 16:26 comment added FMc @LiamBolton Yes, you're on the right track: each test is a 3-element tuple and the line xs, target, expected = test "unpacks" the tuple, assigning each element to a separate variable. Regarding functions, I'm not certain I understand the intended meaning behind your precise phrasing, but setting aside terminology details, I would simply advise you to organize your programs around functions, each performing one small part of the overall job.
Apr 20, 2022 at 15:23 comment added Liam Bolton Appreciate the detailed response :) - So for future reference, my function should always return a value which can then be stored in a variable outside of the local scope? Also the second line in the testing function, am I correct in assuming that the variable test is a list with 3 indexes and you are assigning values to 3 separate variables respective to each index within 1 line of code? From what I remember school never taught me anything remotely close to this - I am very much a beginner again it seems.
Apr 20, 2022 at 7:45 history edited FMc CC BY-SA 4.0
added 1 character in body
Apr 20, 2022 at 7:22 vote accept Liam Bolton
Apr 20, 2022 at 7:21 vote accept Liam Bolton
Apr 20, 2022 at 7:22
Apr 20, 2022 at 6:05 history edited FMc CC BY-SA 4.0
edited body
Apr 20, 2022 at 5:59 history answered FMc CC BY-SA 4.0