Python Learning
5.92K subscribers
424 photos
1 video
57 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
What is an F-String in Python?
❀3
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
10%
"hello"
75%
"olleh"
10%
"" (empty string)
5%
Error
❀1
What will be Printed?
Anonymous Quiz
65%
"abababc"
6%
"abababcc"
12%
"abcabcabc"
17%
Error
Selection Sort Using Python
πŸ‘2❀1
Collection Data Types in Python
❀1