Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions