Skip to content

Instantly share code, notes, and snippets.

View chicagowebmanagement's full-sized avatar

Patrick Elward chicagowebmanagement

View GitHub Profile
@chicagowebmanagement
chicagowebmanagement / list-combining.py
Created March 21, 2019 17:14
3 lists, combine them and list elements of 1 list
lists = list()
fruit=["apple", "orange", "pear"]
bands=["U2","Bananarama", "George Thorogood", "Simple Minds"]
drinks=["vodka","beer","whiskey","cranberry juice"]
print("Current lists has members: ", lists)
lists.append(fruit)
print("Current lists has members: ", lists)
lists.append(bands)
print("Current lists has members: ", lists)
lists.append(drinks)
@chicagowebmanagement
chicagowebmanagement / list-tuple-0325-2019.py
Created March 25, 2019 15:02
another list and tuple mockup
x = {"donnere":"valvore","kosciusko":"manadara"}
print(x)
print(type(x))
x = ("gasadsf","True",99505,False)
print(x)
print(type(x))
x = ["donnere","valvore","kosciusko","manadara"]
print(x)
@chicagowebmanagement
chicagowebmanagement / dictlisttuple.py
Created March 25, 2019 15:39
dictionary, list and tuple examples
crash={"age":"55","living at":"Oak Lawn","Studying":"Python"}
print(crash)
print(type(crash))
print(["age"])
crash2=["Chicago","Libertyville","Palatine","Oak Lawn"]
print(crash2)
print(type(crash2))
print(crash2[1])
@chicagowebmanagement
chicagowebmanagement / dictionarySTP.py
Last active March 25, 2019 19:21
Gets info: stores as dictionary, outputs on single line for each k:v
"""
Three Exercises from GoSelfTaught for Dictionaries.
Combining all three exercises into one file.
First is a simple dictionary
Second is a user populated dictionary
Third is bands to songs
"""
whoami={"height":"5\'9","fave color":"yellow","author":"stone"}
print(whoami)
print(type(whoami))
@chicagowebmanagement
chicagowebmanagement / itlives.py
Created March 25, 2019 22:14
A dictionary with A list, a tuple and a dictionary
listy={"Siblings":["Patrick", "Steve", "John", "Ricardo","Melissa"]}
tuply={"1532 House Location":("42.014078", "-87.669435")}
dicty={"Address":{"county":"Cook", "planet":"Earth","galaxy":"Milky Way"}}
print(listy)
print(tuply)
print(dicty)
@chicagowebmanagement
chicagowebmanagement / 333.py
Created March 28, 2019 00:17
Create the string "three three three" using concatenation, and then again using multiplication.
"""
Create the string "three three three" using concatenation, and then again using multiplication.
"""
x = "three "
print(x + x + x)
# now, lets use multiplier
print(x*3)
@chicagowebmanagement
chicagowebmanagement / find-m.py
Created March 28, 2019 00:23
Use a method to find the first index of the character "m" in the string "Hemingway".
"""
Use a method to find the first index of the character "m" in the string "Hemingway".
"""
#This will 'split' the word into a list ['He', 'ingway'] - so its NOT what we want
x="Hemingway"
print(x.split("m")
@chicagowebmanagement
chicagowebmanagement / camus.py
Created March 28, 2019 00:26
Print every character in the string "Camus".
#Print every character in the string "Camus".
x="Camus"
for i in x:
print(i)
@chicagowebmanagement
chicagowebmanagement / string-list.py
Last active March 28, 2019 20:20
collect two strings and format them
"""
Author: Patrick Elward
Date: 03/27/2019
Write a program that collects two strings from a user,
inserts them into the string "Yesterday I wrote a [response_one]. I sent it to [response_ two]!" and prints a new string.
"""
x=input("Give me a response: ")
y=input("Give me another response: ")
@chicagowebmanagement
chicagowebmanagement / gist:e785b42e4e39657d6d67a6f4da739d18
Created March 28, 2019 00:44
Make the first letter of this string uppercase: "aldous Huxley was born in 1894."
"""
Author: Patrick Elward
Date: 03/27/2019
Make the first letter of this string uppercase: "aldous Huxley was born in 1894
Note: capitalize does NOT need a parameter
"""
x="aldous Huxley was born in 1894."
print(x.capitalize())