#The while loop in Python uses a counter variable as a #condition. The counter is incremented by 1 at the end of #each iteration of the loop and the condition (counter < 5) #is checked at the beginning of each iteration of the loop. #The while loop will keep looping as long as the condition …
Tag Archives: loop
Python: How to initialize a 10-entry Dictionary(hash)
#initialize hash directory counts={i:0 for i in ‘0123456789’} #We have now initialized a dictionary hash named counts with 10 entries: 0-10 with each entry having a value of 0. #we display the entries of the counts dictionary by simply calling its name: counts #here is the output from my terminal