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
print("Welcome to FULL CAPS SHOUTtron") | |
insult=input("We meet again human. What am I?") | |
print("OH YEAH? YOU'RE A "+insult.upper()) | |
#adding .upper() makes the string all uppercase (capital letters) |
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
#Prints all functions available to the user in a module. Great way to find out all the useful functions that a module (in this case time) can let you access. Try substituting "time" with other modules like "math". | |
import time | |
everything =dir(time) | |
print(everything) |
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
#------------------------------------------------------- | |
#The Mr. Murray Detector 9000 | |
#------------------------------------------------------- | |
#The program asks the user 3 yes or no questions | |
beard=input("Does this person have a beard? yes or no?") | |
shirt=input("Does this person wear a shirt? yes or no?") | |
science=input("Is he talking about science? yes or no?") | |
#only gives the Mr. Murray answer if all three are equal to yes. | |
if beard=="yes" and shirt=="yes" and science=="yes": |
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
def epicINATOR(word): #defines the function | |
print(word+"???") #prints it back with some question marks | |
print("more like...") | |
yoke = word+"INATORRRRR!!!" #adds INATORRR to the word you type in | |
yoke = yoke.upper() #makes is UPPER CASE | |
print(yoke) | |
print("THE ROMAN GOD OF " + word.upper() +"ING!") #sticks the result in a sentance | |
while True: | |
epicINATOR(input("Giveth me a word mortal.. ")) #calls the function with a user input as it's value |
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
bag = ['pokeball',"pokedex"] #makes a list with two items called bag | |
print("Welcome to the pokeshop!") | |
print("Let's see what's in your bag") | |
print (bag) #prints out what items are in the bag starting off | |
while True: #loops this part till a purchase is made |
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
#This program accepts an input from the user and then searches through a list to see if there is a match. | |
#It then counts how many matches there are. | |
bag = ["raspberry", "pokeball", "pokeball", "pokeball", "great ball", "potion"] #This is the list of items in the bag | |
print (bag) #Prints the contents of the bag | |
count = 0 #starts the count at 0 |
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
# this piece of code prints out characters and makes the list of words into uppercase | |
#The list as it is normally | |
inventory = ["pickaxe", "sword", "diamonds"] | |
print(inventory) | |
#Method 1: Using .upper each time |
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
# this piece of code prints out characters and makes the list of words into uppercase | |
#The list as it is normally | |
inventory = ["pickaxe", "sword", "diamonds"] | |
print(inventory) | |
#Method 1: Using .upper each time |
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
score = 0 #set the starting score to 0 | |
print (score) #prints the score | |
score = score + 1 #adds 1 to the score | |
print(score) #prints the score | |
score = score + 1 #adds 1 to the score | |
print(score) #prints the score | |
score = score + 3 #adds 3 to the score |
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
# / means divide | |
# 10/2 is ten divided by 2 | |
# 10/2 = 5 | |
# % means remainder | |
# 10%2 is how much is left over (remainder) when 10 | |
# is divided by 2. | |
# 10%2 = 0 | |
if 6%2 == 0: |
OlderNewer