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
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) |
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
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) |
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
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]) |
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
""" | |
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)) |
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
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) |
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
""" | |
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) |
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
""" | |
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") |
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 every character in the string "Camus". | |
x="Camus" | |
for i in x: | |
print(i) |
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: 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: ") |
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: 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()) |