Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Help with Classes
Post: RE: Help with Classes
i tried to solved it but i don't know either how to combine the lists you want.Sorry!!
Perhaps we will never learn how to do it! |
|
sonedap |
Homework |
30 |
11,224 |
Feb-19-2019, 06:56 AM |
|
|
Thread: Help with Classes
Post: RE: Help with Classes
I will try and solve it but I hope so other more experienced will help you. |
|
sonedap |
Homework |
30 |
11,224 |
Feb-18-2019, 08:44 PM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
i tried to run the part of the codes you wrote like this one:
>>> for i in range(1, 5):
... print(f'The first element of the list is {list(range(1, i+1))} with sum {sum(range(1, i+i))}')
.... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-03-2019, 06:39 PM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
Then why you used it (zip) since the exercise refers to list? **huh** |
|
sonedap |
Homework |
17 |
7,060 |
Feb-03-2019, 12:29 PM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
Well, I am looking for zip and.format to read their uses and
Zip is saying that is used for Tuples.
Isn't Tuple different from List? |
|
sonedap |
Homework |
17 |
7,060 |
Feb-03-2019, 10:03 AM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
(Feb-02-2019, 11:32 PM)perfringo Wrote: (Feb-02-2019, 10:58 PM)sonedap Wrote: The zip part and f' I haven't found them in the books yet so I am trying to solve it with using for or while.. The sim... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-03-2019, 08:53 AM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
Well,since I am new to python I think it's better to try solve the exercise with everything I have read so far.
The zip part and f' I haven't found them in the books yet so I am trying to solve it wit... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-02-2019, 10:58 PM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
I want to make a list which contains other lists in the following pattern:
List=[[1],[1,2],[1,2,3]] etc
the second part is to find sum of each sublist and print a message
like "The first elment of th... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-02-2019, 10:24 PM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
I am using 3.7
and trying the code again i am taking as output [range(1,5] etc..
So,since the output is range that means the code is wrong.?
And now i am wondering why i am trying to learn python si... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-02-2019, 10:08 PM |
|
|
Thread: Book exercise in lists
Post: RE: Book exercise in lists
(Feb-02-2019, 06:58 PM)ichabod801 Wrote: Because you are using 5-i. range(5) gives 0, 1, 2, 3, 4, in that order. Five minus that is 5, 4, 3, 2, 1. So your list is [range(1, 5), range(1, 4), range(1,... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-02-2019, 07:51 PM |
|
|
Thread: Book exercise in lists
Post: Book exercise in lists
My university book has lots of exercises to practice and i found this one which wants to make a list with lists and then find sum of each list.
As example it gives that the result should be something ... |
|
sonedap |
Homework |
17 |
7,060 |
Feb-02-2019, 06:19 PM |
|
|
Thread: Class example -i don't understand the error
Post: RE: Class example -i don't understand the error
(Feb-02-2019, 08:01 AM)buran Wrote: As to the original question - I think the idea is to have __init__() in the child class that will override the parent/super class __init__(). You will need also t... |
|
sonedap |
Homework |
9 |
4,241 |
Feb-02-2019, 04:36 PM |
|
|
Thread: Class example -i don't understand the error
Post: RE: Class example -i don't understand the error
(Feb-01-2019, 10:50 PM)Larz60+ Wrote: The real lesson to learn here is that python doesn't need setters and getters, that's java
so,in python how should this code be???
if there are no needs for set... |
|
sonedap |
Homework |
9 |
4,241 |
Feb-02-2019, 06:50 AM |
|
|
Thread: Class example -i don't understand the error
Post: RE: Class example -i don't understand the error
(Feb-01-2019, 04:45 PM)Larz60+ Wrote: The professor must be a java programmer, as stated by Ichabod very poor example.
Since you say it's an assignment, the hints provided above should give you a cl... |
|
sonedap |
Homework |
9 |
4,241 |
Feb-01-2019, 04:50 PM |
|
|
Thread: Class example -i don't understand the error
Post: RE: Class example -i don't understand the error
(Feb-01-2019, 04:34 PM)ichabod801 Wrote: When you call SubClass(), that calls the class's __init__ method. Since __init__ is not defined for SubClass, it inherits the one from its parent, SuperClass... |
|
sonedap |
Homework |
9 |
4,241 |
Feb-01-2019, 04:38 PM |
|
|
Thread: help with list
Post: RE: help with list
(Feb-01-2019, 03:52 PM)ichabod801 Wrote: (Feb-01-2019, 07:56 AM)sonedap Wrote: i will start a new topic for classes later so that yu can explain classes a little better than my professor. Smile
We... |
|
sonedap |
Homework |
22 |
8,548 |
Feb-01-2019, 04:29 PM |
|
|
Thread: Class example -i don't understand the error
Post: Class example -i don't understand the error
class SuperClass:
def __init__(self, a1, a2):
self.attribute1 = a1
self.attribute2 = a2
def getAttribute1(self):
return self.attribute1
def setAttribute1(self, a1):... |
|
sonedap |
Homework |
9 |
4,241 |
Feb-01-2019, 04:24 PM |
|
|
Thread: help with list
Post: RE: help with list
(Jan-31-2019, 04:57 PM)perfringo Wrote: (Jan-31-2019, 03:29 PM)sonedap Wrote: well,i am studying Functions now and i still don't get how they work in general.
Also,i don't understand how this one ... |
|
sonedap |
Homework |
22 |
8,548 |
Feb-01-2019, 07:56 AM |
|
|
Thread: help with list
Post: RE: help with list
(Jan-31-2019, 02:33 PM)perfringo Wrote: You don't understand how functions in Python work or you don't understand how this particular function works?well,i am studying Functions now and i still don'... |
|
sonedap |
Homework |
22 |
8,548 |
Jan-31-2019, 04:44 PM |
|
|
Thread: help with list
Post: RE: help with list
Sorry but i don't understand how fuction works.
So to make it simple i just need to validate in put 2 times before using list in program |
|
sonedap |
Homework |
22 |
8,548 |
Jan-31-2019, 02:30 PM |