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/01/2019 | |
convert string to list using "?" as delimiter | |
""" | |
x="Where now? Who now? When now?" |
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/01/2019 | |
Replace every instance of "s" in "A screaming comes across the sky." with a dollar sign. | |
""" | |
x="A screaming comes across the sky." | |
y= x.replace("s","$") | |
print(y) |
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/01/2019 | |
6. Use a method to find the first index of the character "m" in the string "Hemingway". | |
""" | |
x=list("Hemingway") | |
print("Convert to List results: ",x) # this proves string is now a list (think 'training wheels' for this new coder!) |
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
1. Print every character in the string "Camus". | |
https://gist.github.com/chicagowebmanagement/b0db1a567e84c0326f15110ea532320e | |
2. 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. | |
https://gist.github.com/chicagowebmanagement/d31f529d8281f917b9b40f357a0b04a0 | |
3. Use a method to make the string "aldous Huxley was born in 1894." grammatically correct by capitalizing the first letter in the sentence. | |
https://gist.github.com/chicagowebmanagement/e785b42e4e39657d6d67a6f4da739d18 |
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
def func(a,L=[]): | |
L.append(a) | |
return L | |
print(func(1),func(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
x='"I think the big mistake in schools is trying to teach children anything, and by using fear as the basic motivation. Fear of getting failing grades, fear of not staying with your class, etc. Interest can produce learning on a scale compared to fear as a nuclear explosion to a firecracker.” - Stanley Kubrick' | |
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
""" | |
Author: Patrick Elward | |
Date: 04/04/2019 | |
Slice the string "It was a bright cold day in April, and the clocks were striking thirteen." | |
to only include the characters BEFORE the comma | |
Since I don't know the 'character count' of the comma, I can't use slice, but if I split them into a list, then I can simply print the first item in list. | |
""" |
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/10/2019 | |
Print each item in this list: ["The Walking Dead", "Entourage", "The Sopranos", "The Vampire Diaries"]. | |
""" | |
shows = ["The Walking Dead", "Entourage", "The Sopranos", "The Vampire Diaries"] | |
for show in shows: | |
print(show) |
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/10/2019 | |
An Example of XXX | |
Print all the numbers from 25 to 50 | |
""" | |
home_on_range=range(25,51) | |
for home in home_on_range: |
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/10/2019 | |
Print each item in the list from the first challenge and their indexes | |
["The Walking Dead", "Entourage", "The Sopranos", "The Vampire Diaries"] | |
""" | |
shows= ["The Walking Dead", "Entourage", "The Sopranos", "The Vampire Diaries"] | |
i=0 | |
for show in shows: |