Используйте dict.get() вместо dict[]
Есть несколько способов получения значений из словарей, и даже по такой теме разработчики часто спорят.
Многие получают значения по ключам через квадратные скобки, но если такого ключа нет, то будет вызвано исключение.
Поэтому мы считаем, что лучше использовать метод get у словарей. Его основной плюс заключается в том, что он принимает опциональный аргумент, отвечающий за значение по умолчанию.
Таким образом, если значение по ключу не найдено, то вернется дефолтное значение.
В итоге, мы убираем возможные ошибки в случае, если нужных ключей в словаре нет.
#python#dict
#python
This library helps you test and compare language models by running standard benchmarks like math, reading, coding, and general knowledge tasks. It uses simple, clear instructions to measure how well models perform without complicated prompts, reflecting real-world use better. You can evaluate many models, including OpenAI’s and others, to see their strengths and weaknesses on tasks like problem-solving and factual accuracy. This transparency helps you pick the best model for your needs and understand their capabilities. The library supports easy setup and running of tests via APIs, making it practical for developers and researchers to assess model quality quickly and reliably.
https://github.com/openai/simple-evals
#python
Torchtitan is a PyTorch-native platform designed for easy and large-scale training of generative AI models like Llama 3.1. It supports advanced distributed training techniques such as multi-dimensional parallelism, activation checkpointing, and Float8 precision, enabling efficient use of many GPUs. Torchtitan is modular and cleanly coded, making it easy to extend and customize for different AI research and development needs. It also integrates with PyTorch’s latest features like torch.compile for faster training. This platform helps you rapidly experiment and scale AI model training with minimal code changes, boosting productivity and innovation in generative AI development[1][3][4][5].
https://github.com/pytorch/torchtitan
#python
FieldStation42 is a project that lets you experience old TV like it was in the past. It uses a Raspberry Pi to simulate multiple TV channels with shows and commercials. You can set up different channels, schedule shows, and even add seasonal content. The system supports multiple channels playing at the same time and can automatically insert commercials. This project is great for people who miss the old TV experience and want to relive it with a nostalgic feel. It requires some technical setup but offers a fun way to enjoy retro TV.
https://github.com/shane-mason/FieldStation42
#python
The Jelly Evolution Simulator is a program that lets you watch jelly-like creatures evolve over time. You can run it using a simple command in Python. The simulator allows you to control various features like closing the program, toggling markers, storing species, and changing colors. It also lets you scroll through different generations to see how the creatures change. This tool is useful for understanding how evolution works in a fun and interactive way. It helps users visualize how small changes can lead to different outcomes over time.
https://github.com/carykh/jes
Python bilan yo‘lingizni boshlayapsizmi? Mana sizga kerakli maslahatlar!
Python — oddiy sintaksis, kuchli kutubxonalar va keng imkoniyatlarga ega dasturlash tili. Yangi boshlayotgan bo‘lsangiz, quyidagilarni yodda tuting:
1. Har kuni oz bo‘lsa ham kod yozing
Python’da kuchayishning eng yaxshi yo‘li — amaliyot. Har kuni 30 daqiqa mashq qilish ham yetarli.
2. input(), if, for, def— bu sizning do‘stlaringiz!
Dasturlash asoslari — sizga har qanday murakkab loyihaga eshik ochadi.
3. Real project boshlang!
Masalan: kalkulyator, To-do ilova, Telegram bot yoki oddiy CRUD tizimi. O‘rganishdan ko‘ra, real loyiha qilish 3x ko‘proq foyda beradi.
4. error ko‘rsangiz — xafa bo‘lmang😁
Python xatoliklarni aniqlashni o‘rgatadi. Har bir xatolik — yangi bilim! 🔥
5. Ustozlar va hamjamiyatdan foydalaning
👉Stack Overflow
👉 YouTube’dagi Python kurslar
👉Exercism, Codewars, LeetCode — Python masalalar uchun zo‘r saytlar!
💡Esda tuting:
"Birinchi 100 ta kodlaringiz ishlamasligi normal holat. Muhimi — siz har kuni urinyapsiz."
#python
💻@dasturlash_hayoti— dasturchilar hayoti va dasturlash olami haqida qiziqarli loyiha!