Skip to content

Tag: for-loop

Python hangman Game explaination

I’m having problems wrapping my head around this for loop code. which was part of a Udemy course online and the teacher’s code for the hangman project. This part I understand as we are casting the number of letters in the chosen word into an underscore. This is the part I just do not understand. l…

Loop through variable in python

Please forgive me… new to python and first question on stack. I’m trying to accomplish two things with while loop: increment round number (i’m doing this successfully) have the loop iterate over my variable “fruits” to print the first fruit on round one and second fruit on round …

for loop count monthly total python

I have a data and here has some date time. like this: I need to count monthly total so I do something like this my code is: And her is my output: But I need the total count month by month now. expected output: Thanks in advance Answer this is not the exact solution you want but hope this will

Compute row distance matrix using only for loops

I am stuck in trying to calculate a distance matrix from different binary arrays and I can only use for loops to resolve this… The problem consists of the following; Imagine I have a binary matrix built with different rows as follows, with dimension n=3,m=3 in this case: And I would like to achieve the …