Skip to main content

Posts

Mini contact diary

crate a dictionary and function to add new data Data store: This line creates an empty dictionary named data_store. A dictionary stores data in key-value pairs. def add_data() This line defines a function  named add_data This function can be called later to perform a task in this case, to add a name and mobile number to the dictionary. data_store[key] = value: This line adds the new name and mobile number to the dictionary. save_data() This calls the save_data() function not shown in your code here but assumed to be defined else where. def search_data(): This defines a function called search_data. This function can be called later in the program when you want to look up information  by keyword. if query in data_store: This checks if the entered keyword (query) exists in the dictionary data store. If it does exist, the program will continue to the next line inside the if block. If not, it will skip to the else part. def save_data(): This defines a function named save_dat...
Recent posts

Building a Student Ranking System in Python: A Hands-On Guide to Sorting and File Handling

  Code....    Building a Student Ranking System in Python..                   Have you ever wondered how teachers can quickly arrange students’ marks into a ranking list ? Instead of doing it manually, we can use Python programming to make this task super easy. Take student names and marks as input. Sort students in descending order (highest marks first). Display the rankings.`      Save the results into a text file. Step 1: Collect Student Data.. We start by asking the user how many students are in the class. Then, we take the name and marks of each student. Here, we store each student’s name and marks as a tuple inside a list. Example: [("Alice", 90), ("Bob", 85)] . Step 2: Sort Students by Marks Now that we have the data, we need to sort it based on marks in descending order (highest to lowest). * Lambda x: x[1] means we are sorting by the second element in the tuple (the marks). *  R everse=True en...

What Are Variables in Python?

When we start learning Python, one of the first concepts we come across is variables. But what exactly are they? Understanding Variables  A variable is like a container that stores information . Imagine you have a box, and you put something inside it—like a number, a word, or even a list of items. The name of the box is the variable, and the thing inside is the value. In Python, variables don’t need special declarations. You simply assign a value using the = sign, and Python will take care of the rest Think of it like this:  You have a jar, you put candies inside it and stick a label on the jar called candies . Now, whenever you want to know how many candies you have, you just look at candies . Key Points About Variables in python Dynamic Typing: Unlike some other languages, you don't need to specify a variable's type. Python automatically figures it out based on the value you assign to it (e.g., a number, a string, etc.). A Label, Not a Box: A variable in Python is a label ...

Top 3 GitHub Features Every Beginner Should Master

Introduction If you’re just starting your journey as a developer, GitHub can feel a bit overwhelming. It’s packed with tools that professionals use every day but which ones should you focus on first? You don’t need to learn everything at once. Instead, start with the features that will give you the biggest benefits right away: safety, organization, and automation. Here are my top 3 GitHub features that every beginner should master and exactly why they matter. 1. Branches & Pull Requests Branches let you create  a copy of your project to try out new changes without ever touching the main, working code. It's like having a clone of your project where you can experiment freely.  Pull Requests   are how you propose merging those new changes back into the main project. They serve as a formal request to "pull" your changes from your branch into the main one, often after a review process. Benefits : You can experiment without fear of "breaking"...

From Code to Cloud - Understanding Hosting 🌐

Hosting (or Web Hosting) is a service that allows individuals or organizations to store their website files (HTML, CSS, images, videos, etc.) on a server connected to the internet so that anyone in the world can access the website via a domain name (like www.google.com).  Ever wondered how a website like youtube.com stays online 24/7 for anyone in the world to visit? The answer is hosting . It’s the essential service that makes your website visible on the internet and accessible to everyone, everywhere.  To understand it, let’s use a simple and relatable analogy: building and living in a house. The Landlord, the Land, and the House   Imagine your website is a house you want to build and open for visitors. The Website is the House: Your website is a collection of all its different parts. The front door is your homepage, the rooms are the other pages, and the furniture, decor, and art are all the files that give your site its look and feel. These are files like index....