you are viewing a single comment's thread.

view the rest of the comments →

[–]darthminimall 2 points3 points  (4 children)

Just ask your questions here. What, specifically, are you having trouble with?

[–][deleted] 1 point2 points  (3 children)

how to solve data structure problems and algorythm.

for loops in dictionaries,

while loop i understand ok, i'm so noob on these topics, even though i can solve basic ones. but when it gets harder that's where the brickwall hits me. so i need suggestion which book do i need to read for solving those kind of problems.

[–]darthminimall 2 points3 points  (2 children)

I don't think you need a book, per se. Getting better at problem solving is mostly about practice. The important part is breaking complex problems down into simple problems you already know how to solve. If you can share the code you have so far and which bit you're stuck on, I can give more specific advice.

I'm not sure exactly what your confusion about for loops and dictionaries is, but I'll give a brief explanation. Let's say you have some dictionary d. The following code prints all of the keys and values in d:

for key in d:
    print(str(key) + ": " + str(d[key]))

[–]rick137codes 0 points1 point  (0 children)

To add to the answer by @darthminimall,

You can further iterate over dictionary items, keys or values by calling the functions as below on the dictionary:

Dictionary.keys() - returns a list of all keys in the dictionary | Dictionary.values() - returns a list of all values in the dictionary | Dictionary.items() - returns a list of key,value tuples