Control Flow: Conditional (while) Loops

Additional Practice

Draw a spiral

import turtle

def draw_spiral(radius):
    original_xcor = turtle.xcor()
    original_ycor = turtle.ycor()
    line_length = 1

    while turtle.distance(original_xcor, original_ycor) < radius :
        turtle.forward(line_length)
        turtle.left(10)
        line_length += 0.1


draw_spiral(300)
turtle.done()

Draw a multicolor spiral

Keep track of the number of iterations the user has guessed in the number guessing game and list them at the end of the game as

Game No | Number | Guess Count | Guesses
-----------------------------------------
1       | 72     | 7           | 50, 75, 62, 67, 68, 70, 72 
2       | 47     | 3           | 50, 25, 47
-----------------------------------------
Minimum guesses: 3