Sitemap

Building Simple CLI Projects in Python

Python Made Easy — (Article 19) Telugu Explanation

Press enter or click to view image in full size

1. What is a CLI Project?

CLI = Command Line Interface
CLI projects ante, manam text-based interaction tho programs run cheyyadam.
Ante, user inputs ni keyboard dwara istadu, and output console lo display avutundi.

Example:

Enter your name: Naresh  
Hello Naresh! 👋
Press enter or click to view image in full size

GUI = Graphical User Interface lo buttons untayi,
but CLI lo matram commands and text use chestam.

Get D Naresh’s stories in your inbox

Join Medium for free to get updates from this writer.

Simple ga cheppali ante, Python lo beginner-friendly real-world mini projects create cheyyadaniki best starting point idhe!

2. Example 1: Simple Calculator

(Addition, Subtraction, Multiplication, Division)

Press enter or click to view image in full size
print("🧮 Simple Calculator 🧮")
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("Choose operation: +, -, *, /")
operation = input("Enter operation: ")
if operation == '+':
print("Result:", num1 + num2)
elif operation == '-':
print("Result:", num1 - num2)
elif operation == '*':
print("Result:", num1 * num2)
elif operation == '/':
if num2 != 0:
print("Result:", num1 / num2)
else:
print("Error: Division by zero not allowed ❌")
else:
print("Invalid operation!")

Explanation:

  • User nundi numbers & operation tiskuntam.
  • if-elif use chesi operation batti result chupistam.
  • / case lo divide by zero check chestam.

Try this once on your system - console lo output chudachu.

3. Example 2: Daily Routine Manager

Press enter or click to view image in full size
print("📅 Daily Routine Manager 📅")
tasks = []while True:
print("\n1. Add Task\n2. View Tasks\n3. Delete Task\n4. Exit")
choice = input("Enter your choice: ")
if choice == '1':
task = input("Enter task: ")
tasks.append(task)
print("Task added successfully ✅")
elif choice == '2':
print("\nYour Tasks:")
for i, t in enumerate(tasks):
print(f"{i+1}. {t}")
elif choice == '3':
num = int(input("Enter task number to delete: "))
if 0 < num <= len(tasks):
deleted = tasks.pop(num-1)
print(f"Deleted task: {deleted}")
else:
print("Invalid task number ❌")
elif choice == '4':
print("Goodbye! 👋 Have a productive day!")
break
else:
print("Invalid choice! Try again.")

Explanation:

  • Tasks ni list lo store chestam.
  • User input batti task add, view, delete cheyyachu.
  • while True loop continuous ga program run cheyyadaniki use chestam until user exits.

4. Example 3: Contact Book Manager

Press enter or click to view image in full size
print("📞 Simple Contact Book 📞")
contacts = {}while True:
print("\n1. Add Contact\n2. View Contacts\n3. Search Contact\n4. Delete Contact\n5. Exit")
choice = input("Enter your choice: ")
if choice == '1':
name = input("Enter name: ")
phone = input("Enter phone number: ")
contacts[name] = phone
print("Contact added ✅")
elif choice == '2':
print("\nAll Contacts:")
for name, phone in contacts.items():
print(f"{name}: {phone}")
elif choice == '3':
search = input("Enter name to search: ")
if search in contacts:
print(f"{search}: {contacts[search]}")
else:
print("Contact not found ❌")
elif choice == '4':
delete = input("Enter name to delete: ")
if delete in contacts:
contacts.pop(delete)
print("Contact deleted 🗑️")
else:
print("Contact not found ❌")
elif choice == '5':
print("Exiting Contact Book... Goodbye 👋")
break
else:
print("Invalid choice! Try again.")

Explanation:

  • Dictionary use chesi name & number store chestam.
  • Easy ga add, search, delete cheyyachu.
  • Real-time console output clear ga untundi.

5. Real-World Project Ideas

You can extend these CLI projects into mini professional tools:

Press enter or click to view image in full size

Summary / Key Takeaways

  • CLI = Command Line Interface → text-based programs.
  • User input ni input() tho tiskuntam.
  • Loops (while True) and conditions (if-elif) are backbone of CLI apps.
  • Dictionaries & Lists useful for data storage.
  • Next step: combine File Handling + CLI to make real apps.

Practice Time

1️.Create a CLI-based “To-Do List” program.
2️.Make a small “Guess the Number” game.
3️.Extend Contact Book with file saving feature.
4️.Create a “Student Marks Manager”.
5️.Try converting one CLI app into GUI (optional advanced).

Previous & Next

Next article: 👉 20. Uploading Projects to GitHub
Previous article: 👉 18. Data Visualization with Matplotlib & Seaborn