Python Basics Notes @pythonRe.pdf
2.4 MB
Python Basics Notes 🐍📚
https://t.iss.one/pythonRe 🔗
#Python #Coding #Programming #LearnPython #Tech #DevCommunity
https://t.iss.one/pythonRe 🔗
#Python #Coding #Programming #LearnPython #Tech #DevCommunity
❤3🔥2
The Python library itertools contains many useful functions. 🐍✨
One of them is compress(), which returns an iterator over the elements from data, for which the corresponding element in selectors is equal to True. 🔍💻
Here's an example: 📝👇
#Python #Programming #Itertools #Coding #Tech #DataScience
One of them is compress(), which returns an iterator over the elements from data, for which the corresponding element in selectors is equal to True. 🔍💻
Here's an example: 📝👇
#Python #Programming #Itertools #Coding #Tech #DataScience
🔥2
Cheat sheet on the basics of Python: 🐍📚
basic syntax and language rules 📝
scalar types — basic data types (int, float, bool, str, NoneType) 🔢
datetime — working with date and time 📅⏰
data structures — Python data structures (list, tuple, dict, set) 🗄
list — mutable lists for storing data collections 📋
tuple — immutable sequences of values 🔒
dict (hash map) — storing data in a key-value format 🗝
set — unique elements without order 🔘
slicing — obtaining parts of sequences through indices and step ✂️
module/library — connecting modules and libraries 🔌
help functions — using help() and dir() to explore the Python API 🛠
#Python #Coding #DataScience #Programming #Tech #DevCommunity
basic syntax and language rules 📝
scalar types — basic data types (int, float, bool, str, NoneType) 🔢
datetime — working with date and time 📅⏰
data structures — Python data structures (list, tuple, dict, set) 🗄
list — mutable lists for storing data collections 📋
tuple — immutable sequences of values 🔒
dict (hash map) — storing data in a key-value format 🗝
set — unique elements without order 🔘
slicing — obtaining parts of sequences through indices and step ✂️
module/library — connecting modules and libraries 🔌
help functions — using help() and dir() to explore the Python API 🛠
#Python #Coding #DataScience #Programming #Tech #DevCommunity
❤3🔥3👍2
Do you know that Python can shift sequences without slicing and creating new lists? 🤔
When you need to cyclically shift data, many use slicing:
But
A negative value rotates the queue in the other direction. ⬅️
This is useful for ring buffers, task schedulers, cyclical queues, and round-robin algorithms. 🔄
🔥
#Python #Programming #Deque #CodingTips #Tech #DevCommunity
When you need to cyclically shift data, many use slicing:
data = data[-1:] + data[:-1]
But
deque.rotate() does this at the level of the data structure and usually works more efficiently for cyclical operations. 🚀q.rotate(1)
A negative value rotates the queue in the other direction. ⬅️
q.rotate(-2)
This is useful for ring buffers, task schedulers, cyclical queues, and round-robin algorithms. 🔄
workers.rotate(-1)
🔥
deque.rotate() allows you to implement cyclical data structures without manual index logic and without creating new lists. 💡#Python #Programming #Deque #CodingTips #Tech #DevCommunity
❤3