Learn Python Coding
40.3K subscribers
702 photos
36 videos
24 files
498 links
Learn Python through simple, practical examples and real coding ideas. Clear explanations, useful snippets, and hands-on learning for anyone starting or improving their programming skills.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
Python Lambda
โค7
Please open Telegram to view this post
VIEW IN TELEGRAM
โค4
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿงฒ The exercise is done. The habit is what you cannot see.

You solve the task, the tests pass, and nobody tells you that the pattern you just used will fall apart at scale.

Create your own AI agent inside Telegram in about a minute and put it next to your practice.

โ–ซ๏ธ paste a solution and get the review: correctness first, then the habit worth changing
โ–ซ๏ธ ask for a harder version of the same task and it writes one
โ–ซ๏ธ send a traceback and get the cause, not a search result
โ–ซ๏ธ writes a runnable script whenever the explanation is not enough
โ–ซ๏ธ remembers which topics you already closed and which you keep failing
โ–ซ๏ธ voice in, voice out โ€” say the algorithm out loud and it corrects you

Setup takes a minute: open the link, start the free trial, name your agent.
30 days free, no card needed.

๐Ÿงฒ Create your agent
Please open Telegram to view this post
VIEW IN TELEGRAM
โค4
Creating Nested Dictionary Values using `setdefault()` ๐Ÿ”ฅ

When grouping data, it's often necessary to check if a key exists, create a container for it, and then add a value.

For example, distributing users by role. Without special methods, this usually involves a separate key check.

users = [
("admin", "alex"),
("user", "max"),
("admin", "kate"),
]

groups = {}

for role, name in users:
if role not in groups:
groups[role] = []

groups[role].append(name)


The setdefault() method allows you to perform this operation directly when accessing the dictionary. If the key exists, it returns its current value. If the key is missing, the provided value is written to the dictionary and then returned:

groups = {}

for role, name in users:
groups.setdefault(
role,
[],
).append(name)


The result is the same structure without a separate key existence check:

print(groups)

# {
# 'admin': ['alex', 'kate'],
# 'user': ['max']
# }


It's important to note that the expression of the second argument is evaluated every time setdefault() is called, even if the key already exists. Therefore, you should avoid creating expensive objects or performing functions with side effects there:

value = cache.setdefault(
key,
build_value(),
)


In this code, build_value() will be called before the method itself is executed. If the value creation should only happen when the key is missing, it's better to use an explicit check or a suitable data structure, such as defaultdict.

๐Ÿ”ฅ setdefault() is well-suited for compactly initializing simple mutable containers when grouping and aggregating data. However, it's important to remember that the provided value is evaluated regardless of whether the key exists.

#Python #Coding #Dicts #Programming #CodeTips #DevLife

โœจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
โค2
๐ŸŒˆ 2026 Job-Seeker Toolkit โ€“ Free Interview & IT Cert Resources

๐Ÿ”ฅThe 2026 hiring market is shifting fast. We've put together a 100% free resource bundle covering #Cisco, #AWS, #PMP, #AI, #Python, #Excel, and #Cybersecurity โ€” including:
โœ…Q&A banks & mock exams
โœ…Behavioral interview guides
โœ…Technical deep-dives for coding & infrastructure roles
โœ…Real-world project scenarios

Perfect for Software Developer Jobs, IT Internships, and Python Projects practice.

๐ŸŽฏ Interview Question Bank โ†’ https://bit.ly/4A6m0hM
๐Ÿชœ Online Free Course For Python & Excelโ†’https://bit.ly/46bUzWm
๐Ÿ“˜ Free Cert Eโ€‘Book โ†’ https://bit.ly/4xXkAVx
โ˜๏ธ Free AI Materials โ†’ https://bit.ly/4xMBLJd
๐Ÿ“Š Cloud Study Guide โ†’ https://bit.ly/4cAQ8rN
๐Ÿง  Free Mock Exam โ†’ https://bit.ly/4xcp3Cx

Tag a friend who's job-hunting or grinding Python projects โ€” let's ace it together! ๐Ÿ’ช
๐Ÿง  Join Study Community:
https://chat.whatsapp.com/DcpVeYSV6xNJzdBQU9eRyU
โ„๏ธ 1-on-1 support: https://wa.link/gyvbek
โค4
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿงฒ Your agent writes the tool. You keep the terminal closed.

You know the shape of the script before you open the editor. The hour goes to argparse, a retry wrapper, a rate limiter you have written eleven times already.

Create your own AI agent inside Telegram in about a minute, and create small tools with it right in the chat.

โ–ซ๏ธ describe a tool in a sentence and it writes, runs and returns the working script
โ–ซ๏ธ ships a mini-app inside Telegram โ€” a form, a converter, a dashboard, no deploy and no hosting
โ–ซ๏ธ drop in a traceback or a repo link and get the fix, not a lecture
โ–ซ๏ธ swap the model per task with one command, so cheap work runs cheap
โ–ซ๏ธ remembers your stack, your conventions and your project for months
โ–ซ๏ธ voice in, answer back โ€” describe the task on the way home, read the result when you are back

Setup takes a minute: open the link, start the free trial, name your agent.
30 days free, no card needed.

๐Ÿงฒ Create your agent
Please open Telegram to view this post
VIEW IN TELEGRAM
โค2
๐Ÿš€Round 2 โ€“ 14-Day CCNA & CCNP Study Sprint!

Our first 21-Day Sprint was a huge success โ€” we saw amazing check-ins, great discussions, and a community that truly learned together. ๐Ÿ™Œ

Now we're back with a faster, tighter 14-Day Sprint โ€” same energy, same prizes, easier to finish! ๐Ÿ’ช

๐Ÿ“… Sprint Period: Sep 14 โ€“ Sep 27 (UTC+8)
๐Ÿ“ How It Works:
โ‘  DM admin: "I'M IN + cert name" (e.g., I'M IN CCNA 200-301)
โ‘ก Check in 12 out of 14 days โ†’ win prizes ๐ŸŽ

๐Ÿ† Prizes (First come, first served!):
1๏ธโƒฃ $10 SPOTO Universal Coupon ร—2
2๏ธโƒฃ Cisco SD-Access Training ($150 value) ร—1
3๏ธโƒฃ Cisco SD-WAN Training ($150 value) ร—1
4๏ธโƒฃ CCNA Training Pro Package ($59.99 value) ร—10
5๏ธโƒฃ Free Cisco Learning Pack โ€“ unlimited for all finishers ๐ŸŽ

โœ… Referral Bonus: Invite a friend โ†’ Get FREE EXAM DEMO
๐Ÿ’ป DM admin to register: https://wa.me/8619559123054
JOIN 14 Days Study Sprint: https://chat.whatsapp.com/KZrAj2HZ3Y5K9UhhNhrApf
โค3