[Solved] struck with raintrap in python

You have multiple problems with your code. Variable names could be more informative l -> left_side. This way you don’t need to have a comment on every line. You use a variable n that is not initialized to anything. Perhaps split your code into multiple functions. Then you can investigate if each function does what … Read more

[Solved] Python 3 : List of odd numbers [duplicate]

When you’re passing values to the function oddnos, you’re not passing a list of values till 15, rather only number 15. So the error tells you, you’re passing an int and not a list, hence not iterable. Try to use range() function directly in the for loop, pass your number limit to the oddnos function. … Read more

[Solved] Accepting only letters as input [closed]

The answer for the first problem: You never defined first_name outside of Players_input. This value is just stored inside the function, and get’s deleted afterwards. (more about this in the link added by gjttt1) There are two ways to solve this: You could make first_name global. But this is a bad style, so I wouldn’t … Read more

[Solved] Python3 error handling

Encapsulate the try/except blocks inside the while loop (not the other way around): while True: try: A() except NewConnectionError as err: # This will also print the reason the exception occurred print (‘Detected error: {}’.format(err)) else: print(“A() returned successfully.”) finally: print (“Next loop iteration…”) You can safely omit the else and finally blocks. I have … Read more

[Solved] I have a list, how can I split words in list to get each letter from list [closed]

You can try to use the two for approach z = [“for”, “core”, “end”] letters = [] for word in z: for element in word: letters.append(element) print(letters) #[‘f’, ‘o’, ‘r’, ‘c’, ‘o’, ‘r’, ‘e’, ‘e’, ‘n’, ‘d’] 0 solved I have a list, how can I split words in list to get each letter from … Read more