Re: [Tutor] Only appending one object to list, when I am expecting more than 1

2019-02-26 Thread Tobiah




On 2/26/19 6:39 AM, AdamC wrote:

Sorry folks - my code didn't work due to my debug var count to ensure that
I was looping properly.

It should be:


As was pointed out, the problem is not in your code.  It's in your
data.  You only have one record with a proper 'tpe' value, so that's
all you get in your media list.


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


Re: [Tutor] Only appending one object to list, when I am expecting more than 1

2019-02-27 Thread Tobiah

Without fully understanding what you're getting at, I'll offer this:

class Car(object):

def __init__(self, **kwargs):

self.features = {
'make': 'Hyundai',
'color': 'purple'
}

self.features.update(kwargs)


c = Car(color='yellow', year=2017)


print c.features

output:

{'color': 'yellow', 'make': 'Hyundai', 'year': 2017}





On 2/27/19 5:25 AM, AdamC wrote:

That's great - bug found. Thanks. However the next question is, how do I
create an instance of a class with variable parameters (i.e. with dateAdded
already computed and stored, or with dateAdded created for the first time)?

I hope that makes sense.

Adam

On Tue, 26 Feb 2019 at 18:24, Tobiah  wrote:




On 2/26/19 6:39 AM, AdamC wrote:

Sorry folks - my code didn't work due to my debug var count to ensure

that

I was looping properly.

It should be:


As was pointed out, the problem is not in your code.  It's in your
data.  You only have one record with a proper 'tpe' value, so that's
all you get in your media list.


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





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


Re: [Tutor] (no subject)

2019-03-18 Thread Tobiah

You need a space between 'def' and '__init__'.
Then you must remove the import statement.  The class
is already defined in your scope and there is no
module called 'Student'.


Tobiah

On 3/15/19 6:54 PM, 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)



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


Re: [Tutor] Fwd: IDLE Terminal

2019-04-16 Thread Tobiah




On 4/16/19 12:54 PM, fatima butt wrote:

[image: image.png]please I need help with IDLE teminal..its giving me error.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



Please copy the error text into your message.
The list won't accept attachments.


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