{}
Visualize
main.py
event = "World War I begins" count = 1910 count_2 = 1918 # Use this variable for the third loop begin = 1914 event_2 = "The end of World War I" event_3 = "World War II begins" begin_2 = 1939 event_4 = "The end of World War II" # Looping from 1910 to 1914 for i in range(5): print(count) if count == 1914: print(event) count += 1 # Looping from 1914 to 1918 for i in range(5): print(begin) if begin == 1918: print(event_2) begin += 1 # Looping from 1918 to 1939 (this is where you want to print count_2) for i in range(21): # Loop 21 times, from 1918 to 1939 print(count_2) if count_2 == 1939: print(event_3) count_2 += 1 # Looping from 1939 to 1945 for i in range(7): print(begin_2) if begin_2 == 1945: print(event_4) begin_2 += 1
Output