+ 3

Somebody please help me with this code

Create a class called Student. Initialize the instance variables: id, class, branch and credits. The Student class should also contain an inner class called DateOfBirth that displays the object's date of birth, formatted as dd-mm-yy, where dd, mm and yy are passed as arguments by the user . Create an object piyush belonging to that class and assign certain values to the attributes id, class, branch and credits for piyush. Pass the object piyush to another class called Promotion that contains a method that increases the credit attribute by 50 and display the resulting credits. Finally, display the date of birth of piyush by using the DateOfBirth inner class. https://code.sololearn.com/c5G7l1maQCwv/?ref=app

12th Dec 2020, 7:21 AM
PUSHPAK DANDE
PUSHPAK DANDE - avatar
4 Réponses
+ 2
PUSHPAK DANDE And also on the last line my code, I don't recommend to use it (Piyush.Promote(credits)) I think it is better to use super().__init__ on Promote(Student) class, but it seems to be working somehow.
12th Dec 2020, 8:25 AM
noteve
noteve - avatar
+ 1
This is working but I'm not very sure if this is what you're looking for. https://code.sololearn.com/cMz8O0A3Tvk6/?ref=app
12th Dec 2020, 8:22 AM
noteve
noteve - avatar
+ 1
PUSHPAK DANDE No, what I mean by that correction is about my last line of my code. Anyway, You're welcome.
12th Dec 2020, 8:30 AM
noteve
noteve - avatar
+ 1
It's working perfect fine , it's giving the desired result. I code using phone and space and tabs while indentation always become a problem for me Thanks dude for the corrections 👍😄
12th Dec 2020, 8:30 AM
PUSHPAK DANDE
PUSHPAK DANDE - avatar