Khalid | Python Tasks Adventurer 🐍

289 posts

Khalid | Python Tasks Adventurer 🐍 banner
Khalid | Python Tasks Adventurer 🐍

Khalid | Python Tasks Adventurer 🐍

@Python__Task

Python enthusiast 🐍 💡 Python tips • 📝 Practical tasks • Python libraries #Python_Task 🐍 #Py_Wisdom

Katılım Eylül 2021
28 Takip Edilen7 Takipçiler
Khalid | Python Tasks Adventurer 🐍
After everyone started talking about AI, I noticed something funny: Many Python creators who used to teach the language, its basics, and its libraries… moved more and more toward AI land 🤖✈️ AI is important, of course. But if everyone runs toward AI, who will keep teaching Python itself clearly? Are we moving too fast into AI and leaving beginner Python learners behind? 🤔 @driscollis @RealBenjizo #Python #PythonCode #Coding #Programming #CodeNewbie #100DaysOfCode
English
0
0
0
32
Khalid | Python Tasks Adventurer 🐍
🐍 Python tip Need to check if all items are equal? Instead of: len(set(items)) == 1 try the cleaner way with more-itertools ✨ from more_itertools import all_equal print(all_equal([1, 1, 1])) # True print(all_equal("aaaa")) # True print(all_equal("abca")) # False 💡 Why all_equal()? ✅ more expressive ✅ works with iterators ✅ supports unhashable items too Even this works 👇 print(all_equal([])) # True #Python #PythonCode #Coding #Programming #100DaysOfCode
English
0
0
0
33
freeCodeCamp.org
freeCodeCamp.org@freeCodeCamp·
For today's coding challenge, you'll get a string, and you'll need to return an object (JS) or a dictionary (Python) mapping each character to the number of times it appears. See if you can solve it on the freeCodeCamp mobile app.
freeCodeCamp.org tweet media
English
2
6
51
5.6K
Mike Driscoll
Mike Driscoll@driscollis·
Python 3.15 beta 1 just dropped! 🐍 Feature freeze is here, which means all the major features are locked in. Highlights: • Lazy imports with the `lazy` keyword • `frozendict` and `sentinel` built-in types • JIT compiler now 8-9% faster on x86-64 Linux • Unpacking in comprehensions • High-frequency statistical profiler • Frame pointers enabled by default If you maintain Python packages, now's the time to test with 3.15 and report any issues. Final release scheduled for October 1st.
English
3
12
80
14.3K
Khalid | Python Tasks Adventurer 🐍
🐍 Python tip itertools.takewhile() is useful when you want to read items only until a certain point. For example: “Keep reading characters until you reach X.” But remember this important detail: When takewhile() reaches X, it consumes it too. It does not return it. And it does not leave it for later 🔁 So takewhile() returns everything before "X"… but "X" itself is gone from the iterator. Here is the example 👇 #Python #PythonCode #Coding #Programming #CodeNewbie #100DaysOfCode
Khalid | Python Tasks Adventurer 🐍 tweet media
English
0
0
0
49
Python Programming
Python Programming@PythonPr·
Python Quiz: What is the Output ? 🐍🐍🐍
Python Programming tweet media
English
24
8
69
5.1K
Khalid | Python Tasks Adventurer 🐍
I wouldn’t say the first one is wrong 🙂 Ternary is nice for very small choices: greatest = a if a > b else b But sometimes if/else is necessary: if role == "admin": log_access(user) send_welcome_message(user) redirect_to_dashboard(user) else: show_access_denied() Here, ternary is not suitable because we are doing actions, not just choosing a value. #Python #PythonCode #Coding #Programming #CodeNewbie
English
0
1
0
116
Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
20
8
114
11.1K