+ 1

Why my code is not running?🤔🤔

class welcome: def __init__(): print("hello")

3rd Sep 2024, 2:29 PM
Amitesh Yadav
Amitesh Yadav - avatar
6 ответов
+ 4
you do not initialize a welcome object
3rd Sep 2024, 3:50 PM
Lisa
Lisa - avatar
+ 4
__init__() needs self as parameter or one needs to make the class static. in both ways, one needs to initialize/ call the method from the static class
3rd Sep 2024, 4:29 PM
Lisa
Lisa - avatar
+ 2
Lisa my bad actually my answer to this question was wrong I got two questions Currently this class is like static class like we have in java? But say I want a traditional class with just it's constructor is that possible just by using self?
3rd Sep 2024, 4:06 PM
Just Some Random Guy
Just Some Random Guy - avatar
+ 2
You need to add Self as parameter to install Data ...
4th Sep 2024, 8:49 AM
HASAN IMTIAZ
HASAN IMTIAZ - avatar
+ 1
Thanks after your suggestions my code is now running. I was missing self parameters and forget to make a object(a=welcome ()).
4th Sep 2024, 1:59 PM
Amitesh Yadav
Amitesh Yadav - avatar
+ 1
Thank You
5th Sep 2024, 1:37 PM
Krishna Naikoti
Krishna Naikoti - avatar