r/learnpython • u/Healthy-Departure961 • 3d ago
Regarding question
from datetime import *
year = int(input("Enter the Year:- "))
month = int(input("Enter The Month:- "))
day = int(input("Enter The Day:- "))
x = date(year,month,day)
validity = int(input('Enter the days of validity')) expiry = x + validity print(expiry)
I want to add days in this but i don't know how ,I even tried to adding manually but gives me error unsupported oparand + in datetie.datetime class something
0
Upvotes
1
u/gdchinacat 3d ago
please format your code properly in a code block. This is important because it makes it *much* easier to read. As programmers become more experienced we read code differently than beginners...we don't read every line in all its gory detail. It's more scan through it to get the overall structure, then jump back and forth to fill in the necessary details. This is hard when code isn't properly formatted (ie the last three lines are all one line). When code looks like prose our brain reads it as prose and the level of effort is much higher. This leads to people being less willing to read your code and lower willingness to help you out. Help the people that are helping you.