Help(NOT SOLVED) | SoloLearn: Learn to code for FREE!

+1

Help(NOT SOLVED)

#Im trying to practice in classes I saw a video where this would work but it says there is no module named student it was supposed to import from student file the student class class Student: def__init__(self,name,major,gpa,is_on_probation): self.name = name self.major = major self.gpa = gpa self.is_on_probation = is_on_probation #this is supposed to be in another file from Student import Student Student1 = Student('Jim','ICT' ,2.0 ,False) Student2= Student('noom','math' ,2.0 ,False) print(Student1.name)

1/13/2021 5:43:43 AM

Spooderman

15 Answers

New Answer

-1

This is the video https://youtu.be/rfscVS0vtbw Time stamp 3:51:25

+5

Sololearn's python modules are limited..

+4

Update ur plugin for pydroid3

+4

Is there any module named student?

+2

I tried in pydroid it said no module named student

+2

Things to check: 1. This code """ class Student: def__init__(self,name,major,gpa,is_on_probation): self.name = name self.major = major self.gpa = gpa self.is_on_probation = is_on_probation '""" Should be stored in a file named "student.py" in the same directory as your another file 2. Create new .py file Python is case sensitive language. So maybe possible that what Tanishq Sangwan is right ,check the letters """ from student import Student Student1 = Student('Jim','ICT' ,2.0 ,False) Student2= Student('noom','math' ,2.0 ,False) print(Student1.name) """

+1

Would this work in another IDE

+1

Reeeeeeeeeeeeeee, its from student import Student, its the wrong caps

+1

0

So there is nothing wrong with the code

0

0

It is wrong not maybe 🤐 😅

0

It's still not working :( can I inbox what it shows

0

Can I ask what platform you are using? Because iirc sololearn dosen't support multiple files

0

Well. Step 1: download same IDE as video so Pycharm (optional but u probably should) Step 1.5: If you downloaded pycharm edu go through the ide python tutorial * u probably should ;) Step 2 name the files the same. For sure is Student.py. put the Student class in there Step 3: create new file (blah.py) Step 4: add import statement. from Student import Student. Files gotta be in same directory. --If not and u put it in a folder. Then shame for keeping things structured lol. Just do what they tell u in the video. But really if its in its own folder then will be from [Folder].[file] import blah Also since you in pycharm Ctrl + Space will give you import options or pick correct one for you can do this from everything. --Type "from" ctrl+space pick it, then type "import" then ctrl+space and pick it. Step 5: if __file__ == __main__: # add your other code here # since entry point is main # or have it in your own function and call it here