Whats the output of "for i in "hello world": print(i)" and why/how is this achieved

output is: "h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d" each character being printed in a new lineA "for" loop is used to itterate over a string "hello world" and print each character, this works by "moving" variable "i" along the string, giving it a different character per every iteration of a loop and then asking to print the value its currently holding

Related Python Mentoring answers

All answers ▸

What is the difference between & and && operators?


Demonstrate a recursive solution to calculate the factorial of a number


Implement a rocket launch countdown.


Write a python function that takes a string as parameter and returns the character in the string with the most occurrences, along with the number of times this character occurs