On 16/03/2019 01:54, Glenn Dickerson wrote:
> 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
> 
> 
> import Student
> student1 = Student('Jim', 'Business', 3.1, False)
> student2 = Student('Pam', 'Art', 2.5, True)
> print(student1.name)
> print(student2.gpa)
> 
> I entered this in IDLE and it failed. Any advice? Thank you.

Please, never just say "it failed".
How did it fail?
Did you get an error message? If so, send us the complete message
Did IDLE crash?
Did the PC crash?
Did it run with no output?
Did it run with the wrong output?

There are so many ways for a program to "fail" we need
more specific details.

In this case I can guess what might have happened.
I suspect you need to read up on how to import and
use an external file, but again there are at least
3 possible errors that you might have and I can't
tell which from the details you provided.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to