Relative Content

Tag Archive for pythoncs50

Is there any need for me to write a conditional to check for a leap year?

I’m currently taking the cs50p course on edx, and I’m currently stuck on the problem set8 Seasons of Love. We were suppose to write a code that calculates the amount of years a person has lived in minutes
But my code does match there’s in the test that they gave. I’m thinking if it has to do with the year I’m currently in ????

I’m trying to make a program for an airline as in (cs50 course, week 2) but there is problem i don’t understand

PS C:Usersbesho> & C:/Users/besho/AppData/Local/Programs/Python/Python312/python.exe c:/Users/besho/OneDrive/Desktop/Py/Classes.py Traceback (most recent call last): File “c:UsersbeshoOneDriveDesktopPyClasses.py”, line 19, in <module> success = flight.add_passenger(person) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “c:UsersbeshoOneDriveDesktopPyClasses.py”, line 9, in add_passenger self.add_passengers.append(name) ^^^^^^^^^^^^^^^^^^^ AttributeError: ‘Flight’ object has no attribute ‘add_passengers’. Did you mean: ‘add_passenger’? PS C:Usersbesho> class Flight(): def __init__(self, capacity): self.capacity = capacity self.passengers = [] def add_passenger(self, name): […]