-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da1a890
commit 46322c6
Showing
18 changed files
with
340 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ask the user what should happen | ||
last_petal = input("What happens when the last petal falls? ") | ||
print(last_petal) | ||
# print a string along with the users repsonse. | ||
print("My dear Bella when the last petal falls", last_petal) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# ask the user to input | ||
have_fear = str(input("Have you fear in your heart? ")) | ||
print(have_fear) | ||
# lowers and compares users input against a string value | ||
if(have_fear.lower() == "yes"): | ||
print("Fear is the path to the dark side. You cannot be a Jedi apprentice.") | ||
else: | ||
print("The force is strong in you. You may be a Jedi apprentice.") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
zones_to_cross = int(input("How many zones must I cross? ")) | ||
print(zones_to_cross) | ||
print("Crossing zones...") | ||
# reverse counts from users provided integer printing each iteration. | ||
for zone in range(zones_to_cross, 0, -1): | ||
print("...crossed zone", zone) | ||
print("Crossed all zones. Jumanji!") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def visit(ghost): | ||
# decise which statement to print back to the user | ||
if(ghost == "Ghost of Christmas Past"): | ||
print("Humbug! I care not for these days of past celebration.") | ||
elif(ghost == "Ghost of Christmas Present"): | ||
print("Humbug! I care not for their suffering.") | ||
elif(ghost == "Ghost of Christmas Future"): | ||
print("Please no more. I will change my ways.") | ||
|
||
|
||
# The following are calls to the function for testing purposes | ||
visit("Ghost of Christmas Past") | ||
visit("Ghost of Christmas Present") | ||
visit("Ghost of Christmas Future") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
health = 100 | ||
print("Your health is 100%. Escape is in progress...") | ||
# loop which runs 5 times | ||
for who in range(0,5): | ||
who_is_that = input("…Oh dear, who is that? ") | ||
print(who_is_that) | ||
# adjust health variable based on users input and print back to the user | ||
if(who_is_that == "Smiler's Bot"): | ||
health = health - 20 | ||
print("Time to jam out of here!") | ||
elif(who_is_that == "Hacker"): | ||
health = health + 20 | ||
print("Yay! Better follow this one!") | ||
else: | ||
print("Phew, just another emoji!") | ||
|
||
print("Escaped! Health is", health) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
def is_league_united(first_hero, second_hero): | ||
# test if the hero variables equal either key heros using OR and AND | ||
if(first_hero.lower() == "superman" and second_hero.lower() == "wonder woman" or first_hero.lower() == "wonder woman" and second_hero.lower() == "superman"): | ||
return True | ||
else: | ||
return False | ||
|
||
def decide_plan(first_hero, second_hero): | ||
# check if the league is united | ||
is_league_united(first_hero, second_hero) | ||
# decises an action based on if the league is united | ||
if(is_league_united(first_hero, second_hero) == True): | ||
print("Time to save the world!") | ||
else: | ||
print("We must unite the league!") | ||
|
||
def run(): | ||
first_hero = input("Enter the name of the first hero ") | ||
second_hero = input("Enter the name of the second hero ") | ||
action = input("league or plan? ") | ||
# decise action based on user inputs | ||
if(action == "league"): | ||
print(is_league_united(first_hero, second_hero)) | ||
elif(action == "plan"): | ||
decide_plan(first_hero, second_hero) | ||
else: | ||
print("Invalid command. Please try again") | ||
|
||
# Run the program | ||
run() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# collect a word from the user | ||
the_word = str(input("Enter a word: ")) | ||
|
||
# print a menu of available options and prompt user for their selection | ||
print(""" | ||
Enter the number for the action you wish to perform | ||
1. Under | ||
2. Over | ||
3. Both | ||
4. Grid | ||
""") | ||
option = int(input("Option ID: ")) | ||
|
||
# function which performs the action selected by the user | ||
def actions(option, the_word): | ||
# action for under | ||
if(option == 1): | ||
print(the_word) | ||
print("*" * len(the_word)) | ||
|
||
# action for over | ||
elif(option == 2): | ||
print("*" * len(the_word)) | ||
print(the_word) | ||
|
||
# action for both | ||
elif(option == 3): | ||
print("*" * len(the_word)) | ||
print(the_word) | ||
print("*" * len(the_word)) | ||
|
||
# action for grid | ||
elif(option == 4): | ||
rows = int(input("Number of rows: ")) | ||
columns = int(input("Number of columns: ")) | ||
print("\n") | ||
|
||
# series of for loops to create the rows and columns based on the users input | ||
for row in range(0, rows): | ||
# top border row | ||
print(" ", end="") | ||
for column in range(0, columns): | ||
print("*" * len(the_word) + " ", end="") | ||
print("\n") | ||
|
||
# middle text row | ||
print("| ", end="") | ||
for column in range(0, columns): | ||
print(the_word + " | ", end="") | ||
print("\n") | ||
|
||
# bottom border row | ||
print(" ", end="") | ||
for column in range(0, columns): | ||
print("*" * len(the_word) + " ", end="") | ||
|
||
else: | ||
print("Error") | ||
|
||
# run the actions function | ||
actions(option, the_word) | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# function which performs the action selected by the user | ||
def actions(option, the_word): | ||
# action for under | ||
if(option == 1): | ||
print(the_word) | ||
print("*" * len(the_word)) | ||
|
||
# action for over | ||
elif(option == 2): | ||
print("*" * len(the_word)) | ||
print(the_word) | ||
|
||
# action for both | ||
elif(option == 3): | ||
print("*" * len(the_word)) | ||
print(the_word) | ||
print("*" * len(the_word)) | ||
|
||
# action for grid | ||
elif(option == 4): | ||
rows = int(input("Number of rows: ")) | ||
columns = int(input("Number of columns: ")) | ||
print("\n") | ||
|
||
# series of for loops to create the rows and columns based on the users input | ||
for row in range(0, rows): | ||
# top border row | ||
print(" ", end="") | ||
for column in range(0, columns): | ||
print("*" * len(the_word) + " ", end="") | ||
print("\n") | ||
|
||
# middle text row | ||
print("| ", end="") | ||
for column in range(0, columns): | ||
print(the_word + " | ", end="") | ||
print("\n") | ||
|
||
# bottom border row | ||
print(" ", end="") | ||
for column in range(0, columns): | ||
print("*" * len(the_word) + " ", end="") | ||
|
||
else: | ||
print("Error") | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# importing other python script but only the actions function | ||
import functions | ||
from functions import actions | ||
|
||
# collect a word from the user | ||
the_word = str(input("Enter a word: ")) | ||
|
||
# print a menu of available options and prompt user for their selection | ||
print(""" | ||
Enter the number for the action you wish to perform | ||
1. Under | ||
2. Over | ||
3. Both | ||
4. Grid | ||
""") | ||
option = int(input("Option ID: ")) | ||
|
||
|
||
# run the actions function | ||
functions.actions(option, the_word) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
print("Welcome to the Planet of the Apes...") | ||
humans = 0 | ||
apes = 0 | ||
|
||
for iteration in range(0,7): | ||
human_or_ape = input("be ye human or be ye ape? ") | ||
if(human_or_ape.lower() == "human"): | ||
humans = humans + 1 | ||
print("I did not start this war. But i will finish it.") | ||
elif(human_or_ape.lower() == "ape"): | ||
apes = apes + 1 | ||
print("Apes together strong!") | ||
else: | ||
print("This is not your fight.") | ||
|
||
print("Total humans encountered:",humans) | ||
print("Total apes encountered:",apes) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
def isFusionShot(slug1, slug2): | ||
if(slug1 == slug2): | ||
return True | ||
else: | ||
return False | ||
|
||
def isDefectiveShot(slug1, slug2): | ||
fusion = isFusionShot(slug1, slug2) | ||
if(fusion == False): | ||
return True | ||
else: | ||
return False | ||
|
||
def run(): | ||
slug1 = input("Enter first slug (Infurnus/AquaBeek) ") | ||
slug2 = input("Enter second slug (Infurnus/AquaBeek) ") | ||
action = input("Fusion or Defective? ") | ||
|
||
print("\n") | ||
|
||
if(action.lower() == "fusion"): | ||
print(isFusionShot(slug1, slug2)) | ||
elif(action.lower() == "defective"): | ||
print(isDefectiveShot(slug1, slug2)) | ||
else: | ||
print("Invalid selection. Please try again") | ||
|
||
run() | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
given_number = int(input("Enter a 5 digit number: ")) | ||
|
||
print("You entered:", given_number, """ | ||
1. Display ASCII Triangle | ||
2. Display Left Digits Triangle | ||
3. Display Right Digits Triangle | ||
""") | ||
|
||
selected_option = int(input("Enter your selection ID: ")) | ||
|
||
def actions(selected_option, given_number): | ||
if(selected_option == 1): | ||
print("Display ASCII Triangle\n") | ||
|
||
for iteration in range(0, 9): | ||
print("*" * iteration) | ||
print("*", given_number, "*") | ||
print("*" * 10) | ||
|
||
elif(selected_option == 2): | ||
print("Display Left Digits Triangle\n") | ||
numbers = "" | ||
|
||
for number in str(given_number): | ||
numbers = numbers + number | ||
print(numbers) | ||
|
||
elif(selected_option == 3): | ||
print("Display Right Digits Triangle\n") | ||
|
||
numbers = "" | ||
|
||
for number in str(given_number): | ||
numbers = numbers + number | ||
print(numbers.rjust(5)) | ||
|
||
else: | ||
print("error - oops") | ||
|
||
actions(selected_option, given_number) |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
def actions(selected_option, given_number): | ||
if(selected_option == 1): | ||
print("Display ASCII Triangle\n") | ||
|
||
for iteration in range(0, 9): | ||
print("*" * iteration) | ||
print("*", given_number, "*") | ||
print("*" * 10) | ||
|
||
elif(selected_option == 2): | ||
print("Display Left Digits Triangle\n") | ||
numbers = "" | ||
|
||
for number in str(given_number): | ||
numbers = numbers + number | ||
print(numbers) | ||
|
||
elif(selected_option == 3): | ||
print("Display Right Digits Triangle\n") | ||
|
||
numbers = "" | ||
|
||
for number in str(given_number): | ||
numbers = numbers + number | ||
print(numbers.rjust(5)) | ||
|
||
else: | ||
print("error - oops") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import function | ||
|
||
given_number = int(input("Enter a 5 digit number: ")) | ||
|
||
print("You entered:", given_number, """ | ||
1. Display ASCII Triangle | ||
2. Display Left Digits Triangle | ||
3. Display Right Digits Triangle | ||
""") | ||
|
||
selected_option = int(input("Enter your selection ID: ")) | ||
|
||
function.actions(selected_option, given_number) |