Create a Python file and store this info about yourself:
name = "" # your name
age = 0 # your age
height = 0.0 # your height
is_student = True
print(f"Name: {name}")
print(f"Age: {age}")
print(f"Height: {height}")
print(f"Student: {is_student}")
print(f"Types: {type(name)}, {type(age)}, {type(height)}, {type(is_student)}")
Fill in your actual info, run it and screenshot the output
Bonus — add 3 more variables of your choice
Please open Telegram to view this post
VIEW IN TELEGRAM
Last lecture you learned how to store data in variables
This lecture we go deeper into the most used data type — strings
And we add something that makes your code actually feel alive — user input
This lecture covers:
Please open Telegram to view this post
VIEW IN TELEGRAM
A string is just text — anything wrapped in quotes
name = "Allah"
message = 'Welcome to the channel'
number_as_text = "1234" # this is text, not a number
You can combine strings together — this is called concatenation:
first = "Allah"
second = " Hu Akbar"
print(first + second) # Allah Hu Akbar
And repeat them:
print("Ha" * 3) # HaHaHaPlease open Telegram to view this post
VIEW IN TELEGRAM
We teased this last lecture — now we cover it properly
The messy way:
name = "Allah"
age = 22
print("My name is " + name + " and I am " + str(age) + " years old")
The clean way with f-strings:
name = "Allah"
age = 22
print(f"My name is {name} and I am {age} years old")
Just put f before the opening quote and wrap variables in curly braces
You can even do math inside:
price = 100
discount = 20
print(f"Final price: {price - discount}") # Final price: 80
From now on always use f-strings — forget the + method
Please open Telegram to view this post
VIEW IN TELEGRAM
📌 String Methods
Python gives you built in tools to work with strings
You use them with a dot after the variable
You will use these constantly when building bots
Bots deal with text all day — these are your best friends
Python gives you built in tools to work with strings
You use them with a dot after the variable
name = " allah "
print(name.upper()) # ALLAH
print(name.lower()) # allah
print(name.strip()) # allah — removes extra spaces
print(name.strip().title()) # Allah — capitalizes first letter
message = "Welcome to the channel"
print(message.replace("channel", "group")) # Welcome to the group
print(message.split(" ")) # ['Welcome', 'to', 'the', 'channel']
print(len(message)) # 22
email = "allahlovesram69@gmail.com"
print(email.startswith("allah")) # True
print(email.endswith(".com")) # True
print("gmail" in email) # True
You will use these constantly when building bots
Bots deal with text all day — these are your best friends
input() lets the user type something and your code responds
name = input("What is your name? ")
print(f"Hello {name}!")Run this and type your name — your code just talked back to you
Important — input() always gives you a string
Even if the user types a number you get it as text
So if you need to do math with it, convert it first:
age = int(input("How old are you? "))
print(f"In 10 years you will be {age + 10}")Please open Telegram to view this post
VIEW IN TELEGRAM
name = input("Enter your name: ").strip().title()
age = int(input("Enter your age: "))
city = input("Enter your city: ").strip()
print(f"Name : {name}")
print(f"Age : {age}")
print(f"City : {city}")
print(f"In 5 years you will be {age + 5}")
print(f"Your name has {len(name)} letters")Notice line 1 — we take input, strip spaces, and capitalize all in one line
This is how real clean code looks
Please open Telegram to view this post
VIEW IN TELEGRAM
Watch this after reading through all the posts
Python Full Course 2024 — freeCodeCamp
Covers strings, strip, title case, interactive mode, arithmetic, and formatting numbers
Please open Telegram to view this post
VIEW IN TELEGRAM
Build a personal info card generator
Ask the user for name, age, city and hobby then print a formatted card:
name = input("Name: ").strip().title()
age = int(input("Age: "))
city = input("City: ").strip().title()
hobby = input("Hobby: ").strip().lower()
print("====================")
print(f" Name : {name}")
print(f" Age : {age}")
print(f" City : {city}")
print(f" Hobby : {hobby}")
print(f" Name length: {len(name)} letters")
print("====================")Screenshot your output
Bonus — add one more input of your choice
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
So far your code runs top to bottom and does the same thing every time
No decisions, no logic — just straight execution
This lecture changes that
Conditionals let your code make decisions
Do this IF something is true — do that if it is not
This is the moment your code starts feeling like an actual program
This lecture covers:
Please open Telegram to view this post
VIEW IN TELEGRAM
An if statement runs a block of code only when a condition is true
If the condition is false — it skips that block entirely
age = 20
if age >= 18:
print("You are an adult")
Two things to never forget:
Indentation is not optional in Python
It is literally how Python knows what belongs inside the if block
Miss it and your code breaks
Please open Telegram to view this post
VIEW IN TELEGRAM
else runs when the if condition is false:
age = 15
if age >= 18:
print("You are an adult")
else:
print("You are a minor")
elif checks multiple conditions in order:
score = 75
if score >= 90:
print("Grade: A")
elif score >= 80:
print("Grade: B")
elif score >= 70:
print("Grade: C")
elif score >= 60:
print("Grade: D")
else:
print("Grade: F")
Python checks from top to bottom
The moment one is true it runs that block and skips everything else
Please open Telegram to view this post
VIEW IN TELEGRAM
and — both conditions must be true:
age = 25
has_id = True
if age >= 18 and has_id:
print("Access granted")
else:
print("Access denied")
or — at least one must be true:
is_admin = False
is_owner = True
if is_admin or is_owner:
print("You can edit this")
not — flips the condition:
is_banned = False
if not is_banned:
print("Welcome back")
You will use these constantly in bots
Things like — if user is admin AND message is a command — do this
Please open Telegram to view this post
VIEW IN TELEGRAM
correct_password = "python123"
username = input("Enter username: ").strip().lower()
password = input("Enter password: ").strip()
if username == "admin" and password == correct_password:
print("Welcome back Admin!")
elif username == "admin" and password != correct_password:
print("Wrong password")
else:
print(f"User {username} not found")
Notice how we combined everything from the last 4 lectures
Variables, strings, input, f-strings, and now conditionals
This is how real programs are built — piece by piece
Please open Telegram to view this post
VIEW IN TELEGRAM
Watch this after reading through all the posts
Python Full Course 2024 — freeCodeCamp
Covers conditionals, if/elif/else, modulo operator, and even/odd logic
Please open Telegram to view this post
VIEW IN TELEGRAM