#mangrouppyquiz search results
Almost half way! How have you been scoring? Q5: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
(1/3) Q6 Ans: [10,10,10,10,10] The L1 fns are closures: they have access to a variable from the enclosing scope that has completed its execution (the list comprehension). Py closures are late binding: their value is looked up at the time the closure is called #ManGroupPyQuiz
Just two left, but you may have noticed that they're progressively getting harder - so good luck! Q9: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Final question – has anyone got every question correct so far?! (This one is particularly fiendish!) Q10: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonquestion
(2/2) Python quirk alert: 🐍 keeps an array of ints between -5 & 256 When you create an int in that range you get a reference to a pre-existing object After L8&9, a& b reference the same object again! 🤯 You heard it here first (we assume) #ManGroupPyQuiz #pythonquirkalert
That’s a wrap! Hope you enjoyed the #ManGroupPyQuiz Which question do you think was the hardest? #pythonquiz #pythonprogramming #pythonquirkalert #learntocode
(2/3) By the time the lambda fns are called the list comprehension has executed and i==4 so all the lamba fns return 10. Fix the code in question 6 by writing: multipliers = [lambda x, i=i: (i+1)*x for i in range(5)] #ManGroupPyQuiz #pythonquiz #learntocode
(3/3) This forces the early binding of “i” as a default argument in the lambda fns. This works due to the behaviour we saw in Q4 - default args are created once, at the time the fn is created, rather than when it is called #ManGroupPyQuiz #pythonquiz #pythonprogramming
Q4 Ans: [1,2,3,4,5,6] The default arg, “my_list”, is mutable, so it isn't instantiated with every function call Calling the fn twice adds the other args to the same list instance each time Don't use mutable types as default args! #ManGroupPyQuiz #pythongotcha
Q5 Ans: “Still waiting…” Python does not have a decrement operator so line 4 has no effect. It just gets parsed as two negative signs in a row, i.e. the equivalent of “-(-seconds)” #ManGroupPyQuiz #learncoding #pythonprogramming
Almost half way! How have you been scoring? Q5: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
(1/2) Q10 Ans: True False True “a” & “b” start off referencing the same int object. After L4 & L5 they both reference different int objects with the same value, so no longer have reference equality #ManGroupPyQuiz #pythonquirkalert
Final question – has anyone got every question correct so far?! (This one is particularly fiendish!) Q10: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonquestion
Q9 Ans: Error Tuples do not support item assignment so, while you can add an item to the list at position 0 you cannot then assign that list to be item 0 in the tuple #ManGroupPyQuiz #pythonquiz #pythonprogramming #tuples
Just two left, but you may have noticed that they're progressively getting harder - so good luck! Q9: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Q8 Ans: 12 1 123 1 The += operator only uses the __iadd__ method if it exists. Strings are immutable so do not have __iadd__ therefore lines 3 and 7 are equivalent #ManGroupPyQuiz #pythonquiz #pythongotcha
Our python quiz is now written up for easy reading on @efc_global ! All the @ManQuantTech developers tried their hand at these questions at our virtual offsite last month - Good luck! #ManGroupPyQuiz bit.ly/2Ukx4pC #pythongotchas #pythonquirkalert #pythonprogramming
Our python quiz is now written up for easy reading on @efc_global ! All the @ManQuantTech developers tried their hand at these questions at our virtual offsite last month - Good luck! #ManGroupPyQuiz bit.ly/2Ukx4pC #pythongotchas #pythonquirkalert #pythonprogramming
That’s a wrap! Hope you enjoyed the #ManGroupPyQuiz Which question do you think was the hardest? #pythonquiz #pythonprogramming #pythonquirkalert #learntocode
(2/2) Python quirk alert: 🐍 keeps an array of ints between -5 & 256 When you create an int in that range you get a reference to a pre-existing object After L8&9, a& b reference the same object again! 🤯 You heard it here first (we assume) #ManGroupPyQuiz #pythonquirkalert
(1/2) Q10 Ans: True False True “a” & “b” start off referencing the same int object. After L4 & L5 they both reference different int objects with the same value, so no longer have reference equality #ManGroupPyQuiz #pythonquirkalert
Final question – has anyone got every question correct so far?! (This one is particularly fiendish!) Q10: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonquestion
Final question – has anyone got every question correct so far?! (This one is particularly fiendish!) Q10: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonquestion
Q9 Ans: Error Tuples do not support item assignment so, while you can add an item to the list at position 0 you cannot then assign that list to be item 0 in the tuple #ManGroupPyQuiz #pythonquiz #pythonprogramming #tuples
Just two left, but you may have noticed that they're progressively getting harder - so good luck! Q9: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Just two left, but you may have noticed that they're progressively getting harder - so good luck! Q9: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Q8 Ans: 12 1 123 1 The += operator only uses the __iadd__ method if it exists. Strings are immutable so do not have __iadd__ therefore lines 3 and 7 are equivalent #ManGroupPyQuiz #pythonquiz #pythongotcha
(3/3) This forces the early binding of “i” as a default argument in the lambda fns. This works due to the behaviour we saw in Q4 - default args are created once, at the time the fn is created, rather than when it is called #ManGroupPyQuiz #pythonquiz #pythonprogramming
(2/3) By the time the lambda fns are called the list comprehension has executed and i==4 so all the lamba fns return 10. Fix the code in question 6 by writing: multipliers = [lambda x, i=i: (i+1)*x for i in range(5)] #ManGroupPyQuiz #pythonquiz #learntocode
(1/3) Q6 Ans: [10,10,10,10,10] The L1 fns are closures: they have access to a variable from the enclosing scope that has completed its execution (the list comprehension). Py closures are late binding: their value is looked up at the time the closure is called #ManGroupPyQuiz
Q5 Ans: “Still waiting…” Python does not have a decrement operator so line 4 has no effect. It just gets parsed as two negative signs in a row, i.e. the equivalent of “-(-seconds)” #ManGroupPyQuiz #learncoding #pythonprogramming
Almost half way! How have you been scoring? Q5: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Almost half way! How have you been scoring? Q5: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Q4 Ans: [1,2,3,4,5,6] The default arg, “my_list”, is mutable, so it isn't instantiated with every function call Calling the fn twice adds the other args to the same list instance each time Don't use mutable types as default args! #ManGroupPyQuiz #pythongotcha
Q3 Ans: 2 - 75% got this one correct 👏 “bool” is a subtype of “int” (for quirky historical reasons - bit.ly/2Xy1ipI) so summing the list of bools is equivalent to summing a list of ints #ManGroupPyQuiz #pythonquiz #pythonprogramming
Question 2: What happens if you run this py3 code? #ManGroupPyQuiz #learntocode #codingquiz #fibonacci
First question of our python quiz! What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming #tuples
Almost half way! How have you been scoring? Q5: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Just two left, but you may have noticed that they're progressively getting harder - so good luck! Q9: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonprogramming
Final question – has anyone got every question correct so far?! (This one is particularly fiendish!) Q10: What happens if you run this py3 code? #ManGroupPyQuiz #pythonquiz #pythonquestion
(1/3) Q6 Ans: [10,10,10,10,10] The L1 fns are closures: they have access to a variable from the enclosing scope that has completed its execution (the list comprehension). Py closures are late binding: their value is looked up at the time the closure is called #ManGroupPyQuiz
Something went wrong.
Something went wrong.
United States Trends
- 1. Good Sunday 59.6K posts
- 2. Klay 25.8K posts
- 3. McLaren 109K posts
- 4. #sundayvibes 4,746 posts
- 5. #FelizCumpleañosNico 3,629 posts
- 6. Lando 139K posts
- 7. Ja Morant 11.8K posts
- 8. #FelizCumpleañosPresidente 3,353 posts
- 9. For the Lord 30.4K posts
- 10. #AEWFullGear 73.4K posts
- 11. Tottenham 42.9K posts
- 12. Piastri 79.7K posts
- 13. Oscar 131K posts
- 14. South Asia 39.3K posts
- 15. Max Verstappen 68.8K posts
- 16. #LasVegasGP 235K posts
- 17. Childish Gambino 2,845 posts
- 18. Arsenal 169K posts
- 19. Hangman 11K posts
- 20. Swerve 6,937 posts