This file contains hidden or 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
""" | |
pirple.com/python | |
Python Homework Assignment #7: Dictionaries and Sets | |
Details: | |
Return to your first homework assignments, when you described your favorite song. | |
Refactor that code so all the variables are held as dictionary keys and value. | |
Then refactor your print statements so that it's a single loop that passes through each item in the dictionary | |
and prints out it's key and then it's value. | |
Extra Credit: | |
Create a function that allows someone to guess the value of any key in the dictionary, |
This file contains hidden or 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
""" | |
pirple.com/python | |
Homework Assignment #4: Lists | |
Create a global variable called myUniqueList. It should be an empty list to start. | |
Next, create a function that allows you to add things to that list. | |
Anything that's passed to this function should get added to myUniqueList, | |
unless its value already exists in myUniqueList. | |
If the value doesn't exist already it should be added and the function should return True. | |
If the value does exist, it should not be added, and the function should return False; | |
Finally, add some code below your function that tests it out. |
This file contains hidden or 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
for number in range(2,101): | |
if number % 3 == 0 and number % 5 == 0: | |
print(number,"fizzbuzz") | |
continue | |
if number % 3 == 0: | |
print (number, "fizz") | |
continue | |
if number % 5 == 0: | |
print (number, "buzz") | |
continue |