Python Learning
5.91K subscribers
413 photos
1 video
55 files
105 links
Python Coding resources, Cheat Sheets & Quizzes! πŸ§‘β€πŸ’»

Free courses: @bigdataspecialist

@datascience_bds
@github_repositories_bds
@coding_interview_preparation
@tech_news_bds

DMCA: @disclosure_bds

Contact: @mldatascientist
Download Telegram
#PyQuiz

How many values can a return statement rerurn?
Anonymous Quiz
41%
Only one
19%
One tuple max
31%
Any number
9%
One list only
Wait, why did all functions return 2?

The lambdas don’t capture the value of i at each loop iteration, they capture the variable itself. By the time you call the functions, the loop has finished, and i is left at its final value, 2.

This is called late binding and can cause unexpected behavior when creating closures inside loops.

So as a quick tip, Bind the current value at definition time using a default argument(like shown in the second image) Then each lambda remembers its own i value independently.
❀2
πŸ‘1
#PyQuiz

What is the type of type in Python?
Anonymous Quiz
34%
type
27%
class
28%
object
11%
meta
πŸ‘2
πŸ”₯1
#PyQuiz

What's the output of bool('False')?
Anonymous Quiz
46%
True
40%
False
4%
None
10%
Error
Python Functions You definitely Need to Know
❀3
πŸ‘2❀1