Learn python :Learn Python step by step
Program : Daily Routine Plane using file handling
from datetime import datetime
def getdate():
# datetime object containing current date and time
now = datetime.now()
# dd/mm/YY H:M:S
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
return dt_string
file = int(input("Read file press 1 or entry data press 2"))
person = input("Enter the person name")
if file == 1:
RF = open(person,"r")
p= RF.read()
print(p)
else:
c = int(input("Press 1 for Food and 2 for Exercise"))
if c == 1:
meal = input("Enter the meal")
# def food(meal):
f = open(person , "a")
f.write(str(str(getdate())) + " : " + "Meal- " + meal + "\n")
else:
# def exercise(ex):
ex = input("Enter the exercise name")
f = open(person , "a")
# f.write(ex)
f.write(str(str(getdate())) + " : " + "Ex- " + ex + "\n")
Output
Read file press 1 or entry data press 21
Enter the person nameTarun
05/09/2020 00:56:44 : Roti
05/09/2020 00:59:35 : butter fly
05/09/2020 01:01:20 : Meal-Rice
Learn python :Learn Python step by step
| Week | Topic | Focus |
|---|---|---|
| 1 | Python Basics | Variables, Data Types, Input/Output |
| 2 | Control Structures | If/Else, Loops (for, while) |
| 3 | Data Structures | Lists, Tuples, Sets, Dictionaries |
| 4 | Functions & Modules | Defining Functions, Imports, Scope |
| 5 | File Handling | Reading/Writing Files |
| 6 | Object-Oriented Programming (OOP) | Classes, Objects, Inheritance |
| 7 | Exception Handling & Debugging | try/except, error messages |
| 8 | Final Project | Apply everything in a mini-project |

This is a practical Python project that helps beginners understand file handling through a real-world example. Combining user input, timestamp generation, and file operations into a simple daily routine tracker makes learning more engaging while reinforcing important programming concepts in an easy-to-follow manner.
ReplyDeleteProjects like this provide an excellent foundation for mastering Python programming and developing practical coding skills. Students looking to build more real-world applications can explore Python Projects For Final Year to gain experience with automation, data processing, and application development.
ReplyDeleteAs learners progress beyond the basics, structured guidance and hands-on exercises become increasingly valuable. Enrolling in Python Training Courses helps strengthen programming fundamentals, problem-solving abilities, and practical implementation skills required for academic and professional software development.
ReplyDeletePython is one of the easiest and most popular programming languages for beginners because of its simple syntax, readability, and wide range of applications. It is used in web development, data science, artificial intelligence, machine learning, automation, cybersecurity, cloud computing, and software development.Python Online Course. Beginners should start by installing Python and a code editor such as Visual Studio Code or PyCharm, then learn the fundamentals, including variables, data types, operators, input/output, conditional statements, loops, functions, and basic data structures such as lists, tuples, dictionaries, and sets. Practicing these concepts through small coding exercises helps build a strong programming foundation.
ReplyDelete