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
# Loop Challenges | |
# Solution Video at https://youtu.be/RO7x4qPM8aY | |
# Subscribe to my YouTube Channel at https://www.youtube.com/channel/UC2vm-0XX5RkWCXWwtBZGOXg/playlists | |
# Follow me on Twitter @tokyoedtech | |
import os | |
os.system("clear") | |
print("1.") | |
# Create a loop that prints the string vertically | |
text = "abcdefghijklmnopqrstuvwxyz" |
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
# Top secret decoder | |
# The CIA has discovered a plot against a major city | |
# SIGINT has intercepted a message with the location and date of the attack | |
# Unfortunately, the message is encoded. | |
# Due to your awesome Python skills, you have been hired to decode the message | |
# A double agent has provided the encoding scheme which is as follows: | |
# All numbers need to be changed to spaces | |
# All capital letters should be changed to * | |
# The lowercase letter q is equal to \n | |
# All other lowercase letters should be ignored. |
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
# Rock Paper Scissors ASCII Art | |
# Rock | |
print(""" | |
_______ | |
---' ____) | |
(_____) | |
(_____) | |
(____) | |
---.__(___) |
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
#Janken with Loop Assignment Example by Christian Thompson | |
#Uses Random numbers 1-3 to represent Rock, Paper, Scissors | |
#Initialize | |
import os | |
import random | |
import time | |
#Declare variables |
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
# Function Practice Send and Return Values w/Booleans | |
# Please create and call various functions as explained below. | |
import os | |
os.system("clear") | |
# 1 | |
# Write a function that prints Doh! on the screen. | |
# Call the function print_doh | |
print("1\n") | |
def print_doh(): |
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
import os | |
os.system("clear") | |
print(""" | |
__ ___ | |
(_ |_ _ _ | _ _| | |
__)|_(_|| || (-|( | |
""") | |
# 1) Create a list called captains and add the following names to it: |
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
# Coding Challenge | |
# Reddit: https://www.reddit.com/r/learnprogramming/comments/847ckg/i_failed_a_coding_interview_but_then_afterwards/ | |
# The problem was given a file of sentences, one sentence per line, | |
# implement a function that takes in 2 words, prob(a, b), | |
# and outputs the probability of a occurring given that the | |
# preceding word is b. | |
# Some test data already in a list with punctuation removed | |
sentences = ["Please buy me a drink", | |
"Please buy me a drink Bob", |
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
import time | |
def machine_print(text, delay = 0.1): | |
for letter in text: | |
print(letter, end="", flush=True) | |
time.sleep(delay) | |
print() | |
machine_print("Greetings, Professor Falken. Shall we play a game?") |
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
# Inspirational Sayings | |
# By @TokyoEdTech YouTube Channel: https://www.youtube.com/channel/UC2vm-0XX5RkWCXWwtBZGOXg | |
import tkinter | |
import random | |
root = tkinter.Tk() | |
root.title("Inspiration") | |
root.geometry("225x75") | |
lbl_inspiration = tkinter.Label(root, wraplength=200) |
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
# Simple Snake Game in Python 3 for Beginners | |
# By @TokyoEdTech | |
import turtle | |
import time | |
import random | |
delay = 0.1 | |
# Score |
OlderNewer