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
<component name="InspectionProjectProfileManager"> | |
<profile version="1.0"> | |
<option name="myName" value="Project Default" /> | |
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true"> | |
<option name="ignoredErrors"> | |
<list> | |
<option value="W29" /> | |
<option value="E501" /> | |
</list> | |
</option> |
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
#I McTavish | |
#Oct. 2016 | |
#Demonstrate arrays with complex data types | |
class Aliens: | |
"""Aliens class - represents an alien in a video game""" | |
def __init__(self, x, y): | |
"""x, y are the starting positions""" | |
self.x = x | |
self.y = y | |
self.speed = 10 |
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
#I McTavish | |
#Oct 27, 2016 | |
#Use Lists | |
#Create a list of strings | |
list1 = ['Drew','Sherriee','Lonny','Stacee'] | |
#output full list | |
print(list1) |
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
#I McTavish | |
#Oct 28, 2016 | |
#Demonstrate Lists | |
goals_game = [3,5,2,1,0] | |
totalgoals = 0; | |
for x in range(len(goals_game)): | |
totalgoals += goals_game[x] | |
print(totalgoals) |
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
#I McTavish | |
#Oct 28, 2016 | |
#Demonstrate Lists | |
goals_game1 = 3 | |
goals_game2 = 5 | |
goals_game3 = 2 | |
goals_game4 = 1 | |
goals_game5 = 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
#Name | |
#date | |
#goal: create a program that displays a square using the following pattern | |
""" | |
rbrbrb | |
bbrbrb | |
rrrbrb | |
bbbbrb | |
rrrrrb | |
bbbbbb |
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
#Name | |
#date | |
#goal: create a program that displays random circles on the screen | |
import tkinter#Library | |
import random #Library for random numbers | |
#Global variables | |
CANVAS_WIDTH = 800 | |
CANVAS_HEIGHT = 600 |
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
class BANK_ACCOUNT: | |
"""Bank account | |
has balance, and withdraw and deposit functions""" | |
def __init__(self): | |
self.balance = 0 | |
def deposit(self, amount): | |
"""adds money to the balance""" | |
self.balance += amount | |
def __str__(self): | |
return "Balance is: $" + str(format(self.balance,".2f")) |
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
price = float(input("What is the price? ")) | |
#sample if | |
if price > 100: | |
print("You qualify for a disount of ",format(price*0.10,".2f")) | |
#if statement with else | |
if price < 0: | |
print("That price is invalid") | |
else: | |
print("Proceed with the sale!") |