Created
March 1, 2018 20:11
-
-
Save enseitankad0/c5cf99cf493201e70fc86b2099d44fc1 to your computer and use it in GitHub Desktop.
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
##### LOOPS IN PYTHON ### | |
for i in range(1,10): #1 2 3 4 5 6 7 8 9 default step is i++ | |
print(i) | |
#transversal printing | |
string = "TRANSVERSAL" | |
for i in range (len(string)): | |
print(string[i]) | |
for i in range(3): | |
for j in range(2 ): | |
print(j) | |
### 10x10 multiplication table | |
for i in range (1,11): | |
print('{:<3}|'.format(i)) | |
#the same as transversal | |
for i in range (1,11): | |
print('{:<3}|'.format(i),end="") | |
for j in range (1,11): | |
print ('{:>4}'.format(i*j),end="") | |
if i == 1: | |
print('\n{:_^44}'.format(""),end="") | |
print("") | |
### WHILE ### | |
condition =10 | |
while condition !=0: | |
print(condition) | |
condition = condition - 1 | |
while True: | |
print("helllo 1 time") | |
break | |
# continue | |
for i in range (1,11): | |
if i ==5: | |
continue | |
print(i) ## no 5 in printed list | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment