Python Learning
5.94K subscribers
479 photos
1 video
65 files
109 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

Which of these is NOT a valid Python data type?
Anonymous Quiz
18%
set
15%
dict
57%
array
10%
tuple
Feels off?

It's because all your objects share one variable (without you realizing it)

At first glance, it seems like every object should start fresh, right? But in this case, count is a class variable, which means it’s shared by all instances of the class.

Every time you create a new Counter(), you’re actually incrementing the same shared variable not something unique to each object.

If your goal is to give each object its own value, define it like this instead

class Counter:
    def __init__(self):
        self.count = 1

Now, each instance has its own count, stored on the object itself . no sharing, no surprises.
❀2
#PyQuiz

What does range(5)[-1] return?
Anonymous Quiz
14%
5
48%
4
12%
-1
25%
Error
❀3
What is an F-String in Python?
❀4
Looks neat, right? But let’s slow down.

The *b syntax is called extended iterable unpacking. It grabs everything in the middle of the list, leaving the first item (a) and the last (c) outside the star. This pattern is super handy, but can also behave unexpectedly if you assume it’ll grab just one item or not consider the structure of the data.

The starred variable always gets a list, and it can be empty so plan accordingly when unpacking, especially in function arguments or loops.
For example: Consider the following code
x, *y = [42]
print(y)  # []


No error, but y is just an empty list! Unpacking doesn’t always fill every name the way you might guess.
❀1πŸ‘1
Given the above Python code, what will be printed?
Anonymous Quiz
14%
"hello"
69%
"olleh"
10%
"" (empty string)
6%
Error
❀2
❀1
What will be Printed?
Anonymous Quiz
65%
"abababc"
6%
"abababcc"
15%
"abcabcabc"
14%
Error
Selection Sort Using Python
πŸ‘2❀1
Collection Data Types in Python
πŸ‘4❀3
What will be the output for the above code?
Anonymous Quiz
36%
2.5
47%
2
4%
3
12%
Error
The input function in Python
❀4
Data Structure in Python.pdf
3.3 MB
❀6πŸ”₯1πŸ₯°1
140+ Python Practice Programs - For Real Learning, Not Just Theory

Struggling with Python logic?

Here's over 140 real Python programs that will help you to understand how code actually works-beyond the tutorials.

From basics to interview-level logic:
Arithmetic & conversions
Loops, Recursion, Lists, Arrays
Prime, Fibonacci, Armstrong logic
Matrices, Sorting, Factorials & more

Python pdf
❀5πŸ‘1