Python Program - multiple objects
ฝัง
- เผยแพร่เมื่อ 11 ก.ย. 2024
- Design a class that store the information of Student (rollno, name and age) with a constructor to initialize the data member’s and display() method to display all the details.
1) Accept n-number of students details
2) Display the details of all the students in ascending order of name
Exactly what i have been searching for last one month
Thank u for this lovely comment.
@@MicroNG if i had seen this video a month earlier.. I wud not have got rejected in interview
@@MicroNG sir please give videos on scraping, crawling also...
Loved the way you taught.. 👍👍
Thank u
thankyou, this simple concept was hard to find, very well explained
Thank u for the feedback
good one
Thank you , you code helped my last project
welcome.
This is a great video, but is it possible to achieve the same results without knowing "n"(the number of instances?)
considering student class has been imported into another class, and we want multiple instances of Student objects with necessarily define how many we want.
You saved my life ಥ_ಥ
thank you sir and awesome video 🙏🙏🙌
thank you, it helped me alot
Thank u Faruk for your feedback
we makes object as obj=classname(arg) but in this we do not do same why?
we are making the object same way classname(arg).
Only here we are not mentioning the object name. because we have n, number of objects that will get created dynamically and get inserted into list.
So each element of the list will be an object of the Student class
@@MicroNG See in this case we are creating a 'nameless object' of the class and storing it in the list so we can operate those objects by list reference.
Thanks this was helpful. Would love to know how to pass this list information down to other classes (sub classes, related classes etc.)
nice to hear from u Omkar
Some of the codes did not work such as the append command, and display command
may i know exactly what error is coming
@@MicroNG append doesn't take any parameter, and display require argument position "Self"
Sir can you make video on this program
write a class named as employee for reading and writing the employee information using function getinfo() and displayinfo and also make use of constructor
Okie
Thank you sir
u r not creating multiple objects u r just assigning multiple attributes to single object and saving it each time in a list
i rather make a dictionary with three items and save it in a list whats the purpose of class then if we cant create seperate objects
Each list element is an object of the class defined
If you don't want to store object in a list, it can be created with different names as well
@@MicroNG yes thats what m intrested in how to creat seperate object that i can acces outside the loop