Skip to content

Instantly share code, notes, and snippets.

for i in range(1,100):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)
from random import choice, randint
color = [
'Blue',
'Red',
'Green',
'Yellow',
'Cyan',
'Magenta',
]
noun1 = input("Give me a noun ")
noun2 = input("Give me another noun ")
noun3 = input("Give me another noun ")
number1 = input("Give me number ")
country1 = input("Give me a name of a country")
country2 = input("Give me a name of another country")
adj1 = input("Give me an adjective")
fancy1 = input("Give me a fancy word")
year1 = input("Give me a year")
science1 = input("Give me a scientific term")
import random
n = random.randint(1,100)
guess = int(input("Enter a integer from 1 to 100: "))
while n != "guess":
print
if guess < n:
print ("Guess is too low")
guess = int(input("Enter a integer from 1 to 100: "))
elif guess > n:
print ("Guess is too high")
@coffeechug
coffeechug / Lesson 6 Simple Calculator
Created February 23, 2020 02:31
Basic Math Calculator
a = int(input("What is your first number that you would like to use? "))
b = int(input("What is your second number that you would like to use? "))
math = input("Would you like to add/sub/mul/div? ")
if math == "add":
c = a + b
elif math == "sub":
c = a - b
@coffeechug
coffeechug / Lesson 6 Branch If Elif Else
Created February 23, 2020 02:27
Lesson 6 Branch If Elif Else
answer = int(input('Pick a number ')) #input by itself creates a string, so that is why we are using INT to convert from string to integer
if answer > 10:
print("Your number is greater than 10")
elif answer < 10:
print("Your number is less than 10")
else:
print("Your number is equal to 10")
@coffeechug
coffeechug / Lesson 6 Branch 1 If
Created February 23, 2020 02:26
Lesson 6 Branch 1 If
number = int(input('Enter a number ')) #input by itself creates a string, so that is why we are using INT to convert from string to integer
if number > 10:
print("Your number is greater than 10")
@coffeechug
coffeechug / Lesson 6 Branch 2 If Else
Created February 23, 2020 02:24
Lesson 6 Branch 2
answer = int(input('Pick a number ')) #input by itself creates a string, so that is why we are using INT to convert from string to integer
if answer > 10:
print("Your number is greater than 10")
else:
print("Your number is less than or equal to 10")
@coffeechug
coffeechug / Lesson 5 - Infinite Loop
Created February 23, 2020 02:15
Example code of an infinite loop
while True:
answer = input("Name a color and press enter: ")
print("Please enter another color besides \"" + answer + "\" please.")
@coffeechug
coffeechug / Lesson 4 - Conditional Loops
Created February 23, 2020 02:08
Short example to show how to create conditional loops
answer = "y"
while answer == "y":
print("I need the nectar from the gods!")
answer = input("Do you like coffee? (y/n)")
print ("What is wrong with you!")