Yeah, you read the title right. Today I'm going to share some little python things that made me feel cool and interested as a beginner.
When i first started learning coding, I honestly had no idea where to begin.
I ended up surfing through random resources, ends up getting mixed with different learning sources-even chatGPT. Anyway this lead me taking lots of side roads unintentionally. And those side roads? They turned out to be the fun part. You should learn out of curiosity not from responsibility.
The first code of most coders would be "hello world". and guess what mine was?
it was a CountTimer:
import time
for i in range(10,0,-1):
print(i)
time.sleep(1)
print("Happy bday!")
so the output for this one is:
10
9
8
7
6
5
4
3
2
1
Happy bday!
This looked so cool to me, even though i barely knew what was happening back then. Anyway it was for my sis's bday. And she loved it. Later ,with the help of chatGPT, I actually started understanding what it meant. (Dont worry, I didn't understand that much back then eit.her) But now that i finally learned the 'FOR LOOPS' concept, i got what this simple script means. so let me explain this a bit.
First import time- brings in the time module so you can pause the program for a bit. i mean its like- 10. print it. ok wait for one second. then 9 print it, wait for one sec then 8, print it wait for one sec and so on. this would make it look like timer. (dont forget print() is to print message to screen)
-
Then, the for
loop starts from 10 and goes backwards to 1. That’s what range(10, 0, -1)
does—the -1
means "count in reverse." This is the magic of loop. Each for loop we run through each number. since its 10 and 0 so it counts reverse from 10 to 0 because we gave -1. -1 indicates the computer to read it read backward.
-
Inside the loop, it prints the number, then time.sleep(1)
tells it to wait for 1 second before moving to the next one.
-
After the countdown hits 1 and finishes. Here the loop ends so it needs to move to next command which prints “Happy bday!” like a surprise message.
It’s simple, but when you run it, it feels like the program’s actually doing something real. I love this kind of stuff because it shows how coding can feel alive—not just like writing dry instructions.
But its ok if u didnt understand please feel free to look through tutorials, cause etch this to your hear
"PRACTICE!! PRACTICE!! PRACTICE!!"
***********************************************************************************
Let me show you some other cool things i found.
> datetime 🕒
check this output
ENTER USERNAME :ichigokurosaki
ENTER PASSWORD :soulsociety2
ACCESS GRANTED TO USER-1
LOGIN TIME RECORDED :2025-07-24 14:05:30.672011
This few lines looks cool right? it gives that hacker vibes ! ( enough to look cool for a beginner). Yes that was what my thought too.
I will give you the code for this one.
import datetime
input1=input("ENTER USERNAME :")
input2=input("ENTER PASSWORD :")
print(f"ACCESS GRANTED TO USER-1\nLOGIN TIME RECORDED :{datetime.datetime.now()}")
see?!.
When i was learning, I accidentally discovered .now() from ChatGPT. It made me curious and i dived more into 'datetime' module. That's how i learned to use it like you see above. This felt like i could track real time with my code. Let me explain this to you in simple words, then again if u didn't understand , check tutorials and PRACTICE!!! PRACTICE!!.
Explanation:
First line 'import datetime' brings in Python’s built-in date & time tools.
The f you saw inside print is f strings thats a bit more advanced not usually learned by beginners but guess what i learned this early( blaming it too on chatGPT). Let me tell you the purpose of f strings.f-strings (short for formatted strings) are a super-easy way to add variables inside a string in PythonYou just put an f
before the string and write your variable inside curly braces {}.
IN SHORT F STRING LET YOY PUT VARIABLES DIRECTLY INSIDE A STRING USING{}— and Python will replace it with the actual value when printing. check the code given below
name = "Coder"
print(f"Hello, {Coder}!")
the output will be:
Hello, Coder!
see how it worked perfectly?
-
Then it asks the user to type a username and password (but doesn’t actually check if it’s correct — just for input). remember : in python we print msg using print() and ask input from user using input(). it allows user to input something inside.
-
After entering them, it shows:
-
A message that access is “granted”
-
And logs the exact time you logged in, using datetime.datetime.now()
So basically, it looks like a basic login system, and it prints the current date and time to make it feel like a real terminal system response. cool isnt it?.
Things like this kept me engaged to coding as a beginner. 🖥
******************************************************************************
ANSI CODES. 🌈 🌈
ok, this was unexpected- but made everything look ten times cooler.It let you add color to ur terminal text.You can use ANSI codes to give your terminal programs a hacker vibe, add status messages, or just make things more readable and fun—without needing any extra library. I mainly used the ANSI COLOR CODES to make my output look colorful and vibrant so it would make me feel alive.
Color |
Code |
Usage Example |
Black |
\033[30m |
print("\033[30mBlack\033[0m") |
Red |
\033[31m |
print("\033[31mRed\033[0m") |
Green |
\033[32m |
print("\033[32mGreen\033[0m") |
Yellow |
\033[33m |
print("\033[33mYellow\033[0m") |
Blue |
\033[34m |
print("\033[34mBlue\033[0m") |
Magenta |
\033[35m |
print("\033[35mMagenta\033[0m") |
Cyan |
\033[36m |
print("\033[36mCyan\033[0m") |
White |
\033[37m |
print("\033[37mWhite\033[0m") |
so this is the basic ansi color codes
Lets look at this
import datetime
input1=input("ENTER USERNAME :")
input2=input("ENTER PASSWORD :")
print(f"\033[31m ACCESS GRANTED\033[0m TO USER-1\nLOGIN TIME RECORDED :{datetime.datetime.now()}")
i added ansi escape sequences: \033[31m and \033[0m. to print the words in between( ACCESS GRANTED) in red colour in output. We added those escape sequences to beginning and end of sentence we need to print in different colour. Here in the code we saw 31 is red so output will print in red .It will look cool when ur output shows different colours.
Try all of them when u feel dry as a beginner. i assure you this will make u more engaged.
💭 💭:
Also don't just read these things, GOOOOOOOOOO Y'ALL ,WRITE ITTTT, TRY IT, RUN IT FOR YOURSELVES. I didn't plan to learn coding this way. I just followed my curiosity and landed here- but it made me stay.
so whenever you feel stuck as a beginner:
try small things like this...❤
again PRACTICEEEEEE!!! Y'ALLL!!!!!
NB: The image credit goes to owner. Not mine