Last active
August 29, 2015 14:21
-
-
Save Yagisanatode/69ef647ca3431854aba2 to your computer and use it in GitHub Desktop.
Python 3 - Use In For In Range Loop To Do Differently Occurring Tasks
This file contains hidden or 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
#! Python 3 | |
''' | |
Aim: To ping every fifth time in a count while | |
printing out the count 1 to 20 | |
''' | |
count = 1 | |
for i in range(0,4): | |
print ("ping") | |
for n in range (0,5): | |
print (count) | |
count += 1 | |
''' | |
Result: | |
ping | |
1 | |
2 | |
3 | |
4 | |
5 | |
ping | |
6 | |
7 | |
8 | |
9 | |
10 | |
ping | |
11 | |
12 | |
13 | |
14 | |
15 | |
ping | |
16 | |
17 | |
18 | |
19 | |
20 | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment