Created
December 31, 2013 19:19
-
-
Save nitstorm/8201083 to your computer and use it in GitHub Desktop.
Nested loop example for the blog - http://nitstorm.github.io/blog/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hours = int(input("Please enter number of hours: ")) | |
i = 1 | |
total = 0 | |
#Looping through total number of hours | |
while i<= hours: | |
# Setting iterator for minutes | |
j = 1 | |
# Looping through each minute for current hour | |
while j <= 60: | |
#Setting iterator for seconds | |
k = 1 | |
# Looping through each second for current minute | |
while k <=60: | |
# Adding 1 to the value of total number of seconds counted | |
total = total + 1 | |
k += 1 | |
j += 1 | |
i += 1 | |
print("Total number of seconds in {} hours = {}".format(hours,total)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment