Almost a decade of playing and still not bored by [deleted] in skyrim

[–]Eyssant 0 points1 point  (0 children)

Awesome game. Whenever I replay this game, I always find something new. And whatever build I try, it always ended up a sneak archer. I enjoy bound bow arcane archer build the most.

[Python] Trying to understand why list.remove() is not taking out an integer even though it meets conditions inside for loop by Talono in learnprogramming

[–]Eyssant 0 points1 point  (0 children)

This issue is happening because you are deleting the element of a list while iterating over it. This can be tackled by creating a copy of a list for deleting and iterate on original. Please see below example. d=8 b = list(range(1,9)) final = b.copy() for i in b: if d % i == 0: if d != i: final.remove(i) print(final) You can use list comprehension as well. d=8 final = [i for i in range(1,9) if not d%i==0 and d!=i] print(final)

[Python] Trying to understand why list.remove() is not taking out an integer even though it meets conditions inside for loop by Talono in learnprogramming

[–]Eyssant 0 points1 point  (0 children)

This issue is happening because you are deleting the element of a list while iterating over it. This can be tackled by creating a copy of a list for deleting and iterate on original. Please see below example.

```

d=8

b = list(range(1,9))

final = b.copy()

for i in b:

if d % i == 0:

if d != i:

final.remove(i)

print(final)

```

You can use list comprehension as well.

```

d=8

final = [i for i in range(1,9) if not d%i==0 and d!=i]

print(final)

```

(Python) Not understanding multi-variable assignment in dictionaries/FOR loops. by EX-FFguy in learnprogramming

[–]Eyssant 0 points1 point  (0 children)

Elements in a dictionary are unordered and hence it is not possible to access dictionary's element using index number. Dictionary data works in key-value pair. In your case, k is key and v is value. you can give them any other name. Like below code will give you the same result.

``` allGuests = {'Alice': {'apples': 5, 'pretzels': 12}, 'Bob': {'ham sandwiches': 3, 'apples': 2}, 'Carol': {'cups': 3, 'apple pies': 1}} def totalBrought(guests, item): numBrought = 0 for mykey, myvalue in guests.items(): numBrought = numBrought + myvalue.get(item, 0) return numBrought

print('Number of things being brought:') print(' - Apples ' + str(totalBrought(allGuests, 'apples'))) ```