Question: This is my code can you fix the error, how can I import the module datetime? import datetime class Person: This is for class

This is my code can you fix the error, how can I import the module datetime?

import datetime class Person: """ This is for class person""" def __init__(self, name, surname, birthdate, address, phonenumber, email): self.name = name self.surname = surname self.birthdate = birthdate self.phonenumber = phonenumber self.address = address self.email = email def age(self): today = datetime.date.today() age = today.year - self.birthdate.year if today < datetime.date(today.year, self.birthdate.month, self.birthdate.day): age -= 1 return age p = Person('Meera', 'Amna', datetime.date(2000, 8, 3), 'Ajman', '055677720', 'm22@mail.com') print(p.name) print(p.surname) print(p.birthdate) print(p.phonenumber) print(p.age()) print(p.address) print(p.email)

-------

this is my error

Traceback (most recent call last): File "/Users/meera/PycharmProjects/LAB3/qusetion 5.py", line 28, in p = Person('Meera', 'Amna', datetime.date(2000, 8, 3), 'Ajman', '055677720', 'm22@mail.com') AttributeError: 'module' object has no attribute 'date'

how can I import datatime!!!!!! can you show me please please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!