Code With Python
39.4K subscribers
936 photos
31 videos
22 files
798 links
This channel delivers clear, practical content for developers, covering Python, Django, Data Structures, Algorithms, and DSA – perfect for learning, coding, and mastering key programming skills.
Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
Quiz: Build a Hash Table in Python With TDD

📖 Learn how Python hashing spreads values into buckets and powers hash tables. Practice collisions, uniform distribution, and test-driven development.

🏷️ #intermediate #algorithms #data-structures
A bit of Python basics. Day 2: merging dictionaries

If you have two dictionaries that need to be merged, this can be done in two simple ways. You can use the merge operator (|) or the operator (**). Below we have two dictionaries: first_dict and second_dict. We will use these two methods to merge the dictionaries. Here's the code:

1️⃣ Using the merge operator (|)

first_dict = {"kelly": 23,
              "Derick": 14, "John": 7}
second_dict = {"Ravi": 45, "Mpho": 67}

combined_dict = first_dict | second_dict
print(combined_dict)


Output:

{'kelly': 23, 'Derick': 14, 'John': 7, 'Ravi': 45, 'Mpho': 67}


2️⃣ Method 2: using the merge operator (**)

With this operator, you need to put the dictionaries inside curly braces. In the code below, we "substitute" two dictionaries for merging using two operators *. Both dictionaries are enclosed in curly braces and separated by a comma.

first_dict = {"kelly": 23,
              "Derick": 14, "John": 7}
second_dict = {"Ravi": 45, "Mpho": 67}

combined_dict = {**first_dict, **second_dict}
print(combined_dict)


Output:

{'kelly': 23, 'Derick': 14, 'John': 7, 'Ravi': 45, 'Mpho': 67>


👉 https://t.iss.one/DataScience4
Please open Telegram to view this post
VIEW IN TELEGRAM
1
Python for Loops: The Pythonic Way

📖 Learn how to use Python for loops to iterate over lists, tuples, strings, and dictionaries with Pythonic looping techniques.

🏷️ #intermediate #best-practices #python
2
Spyder: Your IDE for Data Science Development in Python

📖 Learn how to use the Spyder IDE, a Python code editor built for scientists, engineers, and data analysts working with data-heavy workflows.

🏷️ #basics #data-science #tools
Python tip

Adding an element to the end of a list (list.append) works in O(1), but inserting in the middle of the list is O(n) because elements need to be shifted

If you need to efficiently add elements from both ends, use collections.deque — there operations on the edges have complexity O(1)

https://t.iss.one/DataScience4
Forwarded from ADMINOTEKA
This media is not supported in your browser
VIEW IN TELEGRAM
Весна близко, а значит, самое время просыпаться от зимней спячки, радоваться солнцу и… запускать рекламу, которая реально работает 🔥

Мы решили разбудить твой канал по-настоящему и разыграть 3 сертификата на 10 000 охватов каждому победителю — сотни проверенных каналов из различных лиг репостнут любой указанный тобой пост

Как участвовать:
подписаться на 🅰Adminoteka
забустить канал по ссылке https://t.iss.one/boost/adm1noteka

2 марта рандомно выберем трёх счастливчиков. Весна официально начинается 🌸
Please open Telegram to view this post
VIEW IN TELEGRAM
A bit of basics. Day 3: Calendar in Python

There is a built-in module in Python called calendar. We can import this module to display the calendar. There are many things you can do with the calendar.

Let's say we want to see the calendar for April 2022. We use the month class from the calendar module and pass the year and month as arguments. See below:

import calendar

month = calendar.month(2022, 4)
print(month)


There are many other things you can do with calendar. For example, you can use it to check whether a given year is a leap year or not. Let's check if 2022 is a leap year.

import calendar

month = calendar.isleap(2022)
print(month)


False

👉 https://t.iss.one/DataScience4
Please open Telegram to view this post
VIEW IN TELEGRAM
3
How to Use the OpenRouter API to Access Multiple AI Models via Python

📖 Access models from popular AI providers in Python through OpenRouter's unified API with smart routing, fallbacks, and cost controls.

🏷️ #intermediate #ai #api
1
A bit of Python basics. Day 4: Getting the current time and date

The code below shows how to get the current time using the datetime module. The now() method returns a datetime object representing the current date and time according to the system clock. The strftime() method formats the time for the desired output. This code shows how to use the datetime module together with the strftime() method to get a formatted time string in the format of hours, minutes, and seconds.

from datetime import datetime

time_now = datetime.now().strftime('%H:%M:%S')
print(f'Current time: {time_now}')


Current time: 17:37:28


What if we want to return today's date? We can use date from the datetime module. Below, the today() method is used:

from datetime import date

today_date = date.today()
print(today_date)


2023-09-20


👉 https://t.iss.one/DataScience4
Please open Telegram to view this post
VIEW IN TELEGRAM
1
graphical user interface (GUI) | Python Glossary

📖 A visual way of interacting with a program through windows, buttons, and other on-screen elements.

🏷️ #Python
1
How to Run Your Python Scripts and Code

📖 Learn how to run Python scripts from the command line, REPL, IDEs, and file managers on Windows, Linux, and macOS. Master all execution approaches.

🏷️ #basics #best-practices #devops #python
Gift Cards

📖 Give the Gift of Real Python with a membership gift card. An easy way to give joy to the Pythonistas in your life.

🏷️ #Python