+ 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)

13th Jan 2021, 5:43 AM
Noobmaster
Noobmaster - avatar
15 Answers
- 2
This is the video https://youtu.be/rfscVS0vtbw Time stamp 3:51:25
13th Jan 2021, 6:20 AM
Noobmaster
Noobmaster - avatar
+ 7
Sololearn's python modules are limited..
13th Jan 2021, 6:05 AM
VṢtēphen
VṢtēphen - avatar
+ 6
Update ur plugin for pydroid3
13th Jan 2021, 6:12 AM
VṢtēphen
VṢtēphen - avatar
+ 6
Is there any module named student?
13th Jan 2021, 6:15 AM
VṢtēphen
VṢtēphen - avatar
+ 2
I tried in pydroid it said no module named student
13th Jan 2021, 6:09 AM
Noobmaster
Noobmaster - avatar
+ 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) """
13th Jan 2021, 1:11 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
Would this work in another IDE
13th Jan 2021, 6:07 AM
Noobmaster
Noobmaster - avatar
+ 1
Reeeeeeeeeeeeeee, its from student import Student, its the wrong caps
13th Jan 2021, 7:14 AM
Tanishq Sangwan
Tanishq Sangwan - avatar
+ 1
Yes
14th Jan 2021, 2:55 PM
Ramna Ramna
Ramna Ramna - avatar
0
So there is nothing wrong with the code
13th Jan 2021, 6:14 AM
Noobmaster
Noobmaster - avatar
0
No
13th Jan 2021, 6:16 AM
Noobmaster
Noobmaster - avatar
0
It is wrong not maybe 🤐 😅
13th Jan 2021, 1:19 PM
Tanishq Sangwan
Tanishq Sangwan - avatar
0
It's still not working :( can I inbox what it shows
13th Jan 2021, 2:22 PM
Noobmaster
Noobmaster - avatar
0
Can I ask what platform you are using? Because iirc sololearn dosen't support multiple files
14th Jan 2021, 3:47 AM
Tanishq Sangwan
Tanishq Sangwan - avatar
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
15th Jan 2021, 1:02 AM
Javadev