Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: item = index position - list of list
Post: RE: item = index position - list of list
I have also seen that we need to replace the values in the list with 2 and 12, do I have to do it before or after?
I implemented the code:
#create a list from textfile
with open("data.txt") as fil... |
|
RavCOder |
General Coding Help |
9 |
4,095 |
Dec-02-2019, 04:49 PM |
|
|
Thread: item = index position - list of list
Post: RE: item = index position - list of list
But how do I create a pointer in Python? I do a loop, right?
By doing the code you showed you have a list of lists,how do I access the list in the list?
I was thinking of a nested loop, but I don't if... |
|
RavCOder |
General Coding Help |
9 |
4,095 |
Dec-02-2019, 04:36 PM |
|
|
Thread: item = index position - list of list
Post: RE: item = index position - list of list
Ok thank you, i was trying to solve the advent of code on day 2.
But I still can't solve it because I'm stuck on how to access the items inside the list.
I've seen several solutions but I don't want t... |
|
RavCOder |
General Coding Help |
9 |
4,095 |
Dec-02-2019, 03:51 PM |
|
|
Thread: item = index position - list of list
Post: RE: item = index position - list of list
(Dec-02-2019, 03:13 PM)perfringo Wrote: Don’t use list and sum as names.
I don't understand, can you explain better? |
|
RavCOder |
General Coding Help |
9 |
4,095 |
Dec-02-2019, 03:14 PM |
|
|
Thread: item = index position - list of list
Post: item = index position - list of list
Hi,
I have a list of lists taken from a text file.
I would like to add the elements that are in the second and third position,but these are not simple elements, but represent the position of anothe... |
|
RavCOder |
General Coding Help |
9 |
4,095 |
Dec-02-2019, 02:45 PM |
|
|
Thread: Convert HH:MM:SS to seconds
Post: RE: Convert HH:MM:SS to seconds
Hi,
it works,but the map () method is used for iterators, while here I have a string, how can that work (sorry for the stupid question, but it was to understand). |
|
RavCOder |
General Coding Help |
4 |
9,909 |
Nov-26-2019, 01:17 PM |
|
|
Thread: Convert HH:MM:SS to seconds
Post: Convert HH:MM:SS to seconds
Hi,
I was doing this exercise that calculate totalseconds from user input.
This is text:
Quote:Write the algorithm that, having received a time input through three of its three components (hours,
minu... |
|
RavCOder |
General Coding Help |
4 |
9,909 |
Nov-26-2019, 12:49 PM |
|
|
Thread: Matrix understanding in Python
Post: RE: Matrix understanding in Python
I have no other solutions, it's a challenge too difficult for me |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-14-2019, 08:44 AM |
|
|
Thread: Matrix understanding in Python
Post: RE: Matrix understanding in Python
I thought that every human have to "infect" by zombies because the result is a matrix of all 1
Input:
[[0, 1, 1, 0, 1],
[0, 1, 0, 1, 0],
[0, 0, 0, 0, 1],
[0, 1, 0, 0, 0]]
Output: 2
Why... |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-13-2019, 03:15 PM |
|
|
Thread: Matrix understanding in Python
Post: RE: Matrix understanding in Python
I don't have much experience with it but I'm learning now doing this exercise.
Why my approach isn't correct?
I tried also to replace with this:
[1 if x == 0 else x for x in range(len(row))]but I had ... |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-13-2019, 02:36 PM |
|
|
Thread: Matrix understanding in Python
Post: RE: Matrix understanding in Python
Meanwhile I found this to get inside the matrix and scroll through it
list_zombies_human =[[0,1,1,0,1],[0,1,0,1,0],[0,0,0,0,1],[0,1,0,0,0]]
for mat , arr in enumerate(list_zombies_human):
for row_1... |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-13-2019, 02:17 PM |
|
|
Thread: Matrix understanding in Python
Post: RE: Matrix understanding in Python
I think about when scrolling through the list finds the number 0 and make it number 1, but my problem is how do I scroll an array of an array. the indexes I think are just the lists of matrix.
matrix... |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-13-2019, 01:43 PM |
|
|
Thread: Matrix understanding in Python
Post: RE: Matrix understanding in Python
I know it's not correct, but doing nested loops without knowing what I should be looping is difficult |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-13-2019, 12:02 PM |
|
|
Thread: Matrix understanding in Python
Post: Matrix understanding in Python
Hi,
this is text of exercise:
Quote:Given a 2D grid, each cell is either a zombie 1 or a human 0. Zombies can turn adjacent (up / down / left / right) human beings into zombies every hour. Find out ho... |
|
RavCOder |
Homework |
16 |
5,483 |
Nov-13-2019, 11:35 AM |
|
|
Thread: Delete minimum occurence in a string
Post: RE: Delete minimum occurence in a string
the word that I put in my code I created to make the relative part to count the words inside the string. I don't know Counter because I never used it. |
|
RavCOder |
General Coding Help |
10 |
3,915 |
Nov-12-2019, 01:08 PM |
|
|
Thread: Delete minimum occurence in a string
Post: RE: Delete minimum occurence in a string
I don't know exactly how to do it, but I think I have to declare the word I want to search first in
char = "character that I want to search" |
|
RavCOder |
General Coding Help |
10 |
3,915 |
Nov-12-2019, 09:47 AM |
|
|
Thread: Delete minimum occurence in a string
Post: Delete minimum occurence in a string
Hi,
I have to delete minimum number of character in a string.
I saw that there is Counter but I don't know how to use it.
This is my code for now:
word = "abecedario alpaca"
char = ''
word_list = []
... |
|
RavCOder |
General Coding Help |
10 |
3,915 |
Nov-11-2019, 02:13 PM |
|
|
Thread: Sum char word dictionary
Post: RE: Sum char word dictionary
I don't know maybe I should check it but how do I do it? |
|
RavCOder |
General Coding Help |
3 |
2,337 |
Nov-08-2019, 01:16 PM |
|
|
Thread: Sum char word dictionary
Post: Sum char word dictionary
I have a dictionary that gives me a letter of the alphabet as a key and a number that corresponds to the position of the letter of the alphabet.
Quote:{'a':1 'b':2 ... 'z':26}
I would like that if I t... |
|
RavCOder |
General Coding Help |
3 |
2,337 |
Nov-08-2019, 11:38 AM |
|
|
Thread: Print string in a single line
Post: RE: Print string in a single line
Hi perfringo,
I didn't know that string aren't list, but I maybe I think that they refered a string is immutable like a list (then I don't know if this is correct or not).
Forgive me if I said someth... |
|
RavCOder |
General Coding Help |
8 |
4,157 |
Nov-08-2019, 08:52 AM |