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
""" | |
Author: Patrick Elward | |
Date: 10/02/2019 | |
training on OOP with getting area of triangle. | |
THIS WAS NOT WORKING RIGHT in april, but i came back to fix 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
""" | |
Author: Patrick Elward | |
Date: 04/23/2019 | |
extra curricular study of OOP Classes via Corey Schafer on YouTube. | |
""" | |
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
""" | |
Author: Patrick Elward | |
Date: 04/22/2019 | |
revised RPS per Cory's request to A. move code into functions and B. clean up comparison code. | |
""" | |
import random |
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
""" | |
Author: Patrick Elward | |
Date: 04/22/2019 | |
2. Create a Circle class with a | |
method called area that calculates and returns its area. | |
Then create a Circle object, | |
call area on it | |
print the result. | |
Use Python's pi function in the built-in math module. |
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
""" | |
Author: Patrick Elward | |
Date: 04/22/2019 | |
1. Define a class called Apple with four instance variables that represent four attributes of an apple. | |
""" | |
class Apple: | |
def __init__(self,c,f,v,h): | |
self.color=c | |
self.farm=f |
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 random | |
## store our random RPS values as list | |
weapons = ["rock", "paper", "scissors"] | |
playtime='y' | |
while playtime == "y": | |
playtime=input("Want to play Rock, Paper, Scissors? If Yes, hit y, if No, hit n ") |
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
""" | |
Author: Patrick Elward | |
Date: 04/20/2019 | |
Rock Paper Scissors game | |
import random | |
## store our randon RPS values as list | |
weapons = ["Rock", "Paper", "Scissors"] |
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 random | |
def hangman(word): | |
wrong = 0 | |
stages = ["", | |
"________ ", | |
"| ", | |
"| | ", | |
"| 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
""" | |
Author: Patrick Elward | |
Date: 04/18/2019 | |
Take the items in this list of lists: [["Top Gun", "Risky Business", "Minority Report"], ["Titanic", | |
"The Revenant", "Inception"], ["Training Day", "Man on Fire", "Flight"]] and write them to a CSV file. | |
The data from each list should be a row in the file, with each item in the list separated by a comma. | |
flicks.csv then shows this: | |
Top Gun,Risky Business,Minority Report |
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
""" | |
Author: Patrick Elward | |
Date: 04/17/2019 | |
Write a program that asks a user a question, and saves their answer to a file. | |
""" | |
with open("spanish_inquisition.txt","a+") as f: | |
tick=input("what is the time right now?: ") |