Skip to content

Instantly share code, notes, and snippets.

@wynand1004
Last active October 21, 2020 05:38
Show Gist options
  • Save wynand1004/1405a59c72a0b1bd749e01f0d47264bf to your computer and use it in GitHub Desktop.
Save wynand1004/1405a59c72a0b1bd749e01f0d47264bf to your computer and use it in GitHub Desktop.
Patterns to Loops Starter Code
# Finding Patterns
import os
os.system("clear")
# 1
print(1)
print(2)
print(3)
print(4)
print(5)
# 2
print("\n\n")
word = "e-boy"
print(word[0])
print(word[1])
print(word[2])
print(word[3])
print(word[4])
# 3
print("\n\n")
word = "VuSeCllO"
msg = ""
if word[0] == word[0].upper():
print(word[0])
if word[1] == word[1].upper():
print(word[1])
if word[2] == word[2].upper():
print(word[2])
if word[3] == word[3].upper():
print(word[3])
if word[4] == word[4].upper():
print(word[4])
if word[5] == word[5].upper():
print(word[5])
if word[6] == word[6].upper():
print(word[6])
if word[7] == word[7].upper():
print(word[7])
# 4
print("\n\n")
print("0")
print("01")
print("012")
print("0123")
print("01234")
print("012345")
# 5
print("\n\n")
print("012345")
print("01234")
print("0123")
print("012")
print("01")
print("0")
# 6
print("\n\n")
print("0")
print("101")
print("21012")
print("3210123")
print("432101234")
print("54321012345")
# 7
print("\n\n")
print(" 0")
print(" 101")
print(" 21012")
print(" 3210123")
print(" 432101234")
print("54321012345")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment