nested-for-loop

Parse list of strings and find max values

Parse list of strings and find max values Question: I’m quite new to Python and struggling to get my head round the logic in this for loop. My data has two values, a city and a temp. I would like to write a "for loop" that outputs the maximum temp for each city as follows: …

Total answers: 3

Adding string after each vowel

Adding string after each vowel Question: I am currently on a project to develop a small, fun program that takes a name as an input and returns the name with the string "bi" after each vowel in the name. I am encountering the problem that my program runs in an infinite loop when I have …

Total answers: 3

I need help converting this code from one for loop to two nested for loops

I need help converting this code from one for loop to two nested for loops Question: This is an example of the wheat and chessboard problem. I need to write the code using one for loop and two nested for loops. I have written it using one for loop but am having trouble figuring out …

Total answers: 1

Python 2D array not appending additions

Cannot append 2D array Question: I’m trying to create an eight-puzzle game solver, and I have a little problem. My states are being stored as grids(represented by 2D- lists). I am trying to keep track of every resulting state by appending to a succ_states list whenever a move is made by the computer. However, my …

Total answers: 1