Tech with hos
270 subscribers
162 photos
8 videos
1 file
53 links
Hosama | Tech With Hos
Daily simple tech insights β€” programming, computer science basics, tools & modern tech trends.

No fluff. Just clear learning.
YouTube: https://youtube.com/@techwithhos?si=fGJhSe2Rv03aoeW0
Download Telegram
#πŸ”₯ Python OOP Example: Follow System Simulation

# Define a User class
class User:

# Initialize user with ID and username
def __init__(self, user_id, username):
self.id = user_id # Unique ID
self.username = username # User's name
self.followers = 0 # Starts with 0 followers
self.following = 0 # Starts with 0 following

# Define a follow method: this user follows another user
def follow(self, user):
user.followers += 1 # The other user gains a follower
self.following += 1 # This user follows someone


# Create two users
user1 = User("0.01", "Hosama")
user2 = User("0.02", "Angela")

# user1 follows user2
user1.follow(user2)

# Print current stats
print(user1.followers) # Output: 0 β†’ Hosama has no followers
print(user1.following) # Output: 1 β†’ Hosama is following Angela
print(user2.followers) # Output: 1 β†’ Angela is followed by Hosama
print(user2.following) # Output: 0 β†’ Angela is not following anyone

#πŸ”₯ Python OOP Example: Follow System Simulation

# Define a User class
class User:

# Initialize user with ID and username
def __init__(self, user_id, username):
self.id = user_id # Unique ID
self.username = username # User's name
self.followers = 0 # Starts with 0 followers
self.following = 0 # Starts with 0 following

# Define a follow method: this user follows another user
def follow(self, user):
user.followers += 1 # The other user gains a follower
self.following += 1 # This user follows someone


# Create two users
user1 = User("0.01", "Hosama")
user2 = User("0.02", "Angela")

# user1 follows user2
user1.follow(user2)

# Print current stats
print(user1.followers) # Output: 0 β†’ Hosama has no followers
print(user1.following) # Output: 1 β†’ Hosama is following Angela
print(user2.followers) # Output: 1 β†’ Angela is followed by Hosama
print(user2.following) # Output: 0 β†’ Angela is not following anyone


πŸ”₯ Python OOP: Simulate a Follow System Like Instagram/Telegram!

Using just one class and a few lines of code, we can simulate a real-world "Follow" feature. In this example:

βœ… Each user has:
- An ID and username
- A follower count
- A following count

βœ… The follow() method:
- Lets one user follow another
- Updates both users' counts accordingly

🧠 Try making it more realistic: show mutual follows, unfollow feature, or a display method!

#python #oop #beginnercode #telegrambot #follow
πŸ“Š "Reading CSV Files with Python & Pandas!"
#TechWithHos #PythonTips #DataScience*

πŸš€ *"Data is the new oil β€” and Python is the drill."*

In this snippet, we explore how to read and extract data from a CSV file using both Python’s built-in csv module and the powerful Pandas library.

import csv
'''
with open("/Users/kvava/OneDrive/Desktop/002 weather-data.csv") as data_s:
h = data_s.readlines()
print(h)

with open("/Users/kvava/OneDrive/Desktop/002 weather-data.csv") as data_s:
data = csv.reader(data_s)
tempratures = []

for row in data:
if row[1] != "temp":
temp = int(row[1])
tempratures.append(temp)
print(tempratures)
'''
import pandas

data = pandas.read_csv("/Users/kvava/OneDrive/Desktop/002 weather-data.csv")
print(data["temp"])


πŸ” What this code does:

1. The first part (commented out) uses the csv module to manually read temperature values from a CSV file.
2. The second part uses Pandas to read the same file more efficiently β€” and directly accesses the "temp" column.

πŸ“Œ Why use Pandas?
Pandas is a powerful Python library for data manipulation and analysis. It makes working with structured data super easy β€” whether it’s filtering rows, summarizing columns, or transforming tables.

πŸ”₯ With Pandas, a few lines of code can replace dozens!
Perfect for data science, machine learning, or just wrangling messy spreadsheets.



πŸ’‘ Follow @TechWithHos for more Python & tech tips like this!
\#Python #Pandas #CodeSnippet #CSV #LearnToCode #ProgrammingTips
πŸš€ Python List Comprehension – Clean, Powerful, and Pythonic! 🐍

List comprehensions make your code shorter, faster, and more readable. Whether you're transforming, filtering, or generating dataβ€”this tool is a must-know for any Pythonista!

Here’s a quick showcase of how elegant Python can be πŸ‘‡

# Add 1 to each item in a list
new_numbers = [item + 1 for item in numbers]

# Turn a string into a list of characters
name = "Angela"
new_list = [letter for letter in name]

# Square numbers from 1 to 4
new_double = [d * d for d in range(1, 5)]

# Double the numbers from 1 to 4
new_one = [s + s for s in range(1, 5)]

# Filter names with exactly 4 letters
names = ["Alex", "beth", "caroline", "Dave", "elias", "freddie"]
short_names = [sh for sh in names if len(sh) == 4]

# Capitalize names longer than 5 letters
capitalized = [ca.upper() for ca in names if len(ca) > 5]


⚑️ Why use list comprehensions?
βœ… More readable than loops
βœ… Great for data transformations
βœ… Ideal for filtering and mapping
βœ… Just look cooler 😎

🧠 Try tweaking the conditions and expressionsβ€”it's one of the fastest ways to learn Python.

\#Python #ListComprehension #CodeSnippet #PythonTips
# HsAd - Simple GUI using Tkinter

from tkinter import * # Import everything from tkinter (GUI library)
import turtle # Imported but not used in this program

# Create the main window
windows = Tk()
windows.title("My First GUI") # Set window title
windows.minsize(width=5, height=5) # Minimum window size
windows.config(padx=20, pady=20) # Add padding around the window

# ---------------- Label ----------------
# Create a label widget
my_label = Label()
my_label.grid(column=1, row=1) # Place label in grid at column 1, row 1
my_label.config(text="New Text") # Set default text

# ---------------- Button Function ----------------
# Function that runs when the button is clicked
def button_clicked():
input_text = input.get() # Get the text from input field
my_label.config(text=input_text) # Update label text with input

# ---------------- Buttons ----------------
# Create a button that calls 'button_clicked' function when clicked
button = Button(text="Click Me", command=button_clicked)
button.grid(column=2, row=2) # Place the button in grid

# Create a second button (no functionality added yet)
new_button = Button(text="Heyz Come Here")
new_button.grid(column=3, row=1)

# ---------------- Entry (Input Field) ----------------
# Create an input field for user to type in
input = Entry(width=10)
input.grid(column=4, row=3) # Place the input field in grid

# ---------------- Run the GUI ----------------
windows.mainloop() # Start the Tkinter event loop (keeps window open)




πŸ–₯️ Python Tkinter GUI - Beginner Project

Hey coders! πŸ‘‹ Here is Tech with hos
Here's a basic GUI (Graphical User Interface) created using Tkinter in Python. This project includes:

βœ… A window with a title
βœ… A label to display text
βœ… An input box to type text
βœ… A button that updates the label with your input
βœ… Another button just for fun

πŸ’‘ When you type something in the box and click "Click me", the label updates with what you typed. Cool, right?

Perfect for beginners to understand how GUI elements like labels, buttons, and input fields work together. πŸ’»βœ¨

#Python #Tkinter #Beginner #GUI #CodeLearning
#Tech with hos
πŸš€ Why Python for Competitive Programming?
Python isn’t just beginner-friendly β€” it’s a powerhouse for problem-solving. πŸ’‘
With clean syntax, rich libraries, and faster coding speed, you can focus on logic instead of long syntax battles.
It helps you turn ideas into solutions quickly β€” which is exactly what competitive programming is all about. ⚑
πŸ”₯ Simple. Smart. Powerful. That’s Python.
#HosTech #Python #CompetitiveProgramming
❀1
Hey ... if you’re confused about learning AI , this might help.
Most people are not stuck because it’s hard. They’re stuck because they don’t know where to start.
So here’s a simple starting path πŸ‘‡


πŸ’» AI Coding
https://www.cursor.com/
https://github.com/features/copilot

⚑️ AI Agents
https://n8n.io/
https://www.youtube.com/@n8n-io

πŸ“Š
Python + Data
https://www.python.org/
https://pandas.pydata.org/
https://www.kaggle.com/datasets

πŸ”„ Automation
https://www.make.com/
Don’t try everything. Pick ONE thing. Start small. Stay consistent.
And by the way β€” you can go with any of these skills… it will help you leverage your main skill later.
What are you starting with?

πŸ€– Prompt | πŸ’» Coding | ⚑️ Agents | πŸ“Š Data | πŸ”„ Automation

#TechWithHos #LearnAI #Coding #StudentDeveloper #AItools #Python #CursorAI #n8n #TechSkills
❀7