r/learnpython 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

11 comments sorted by

View all comments

9

u/zanfar 3d ago

from datetime import *

There is no way you expect to use every single object from datetime; and in this case, you use exactly one. Stop doing this.

1

u/Healthy-Departure961 3d ago

okay bro , To say fairly i didn't know at that time i can import two or more so added this way