- create an 'InternetRadio' class which implements the
IConnect
interface and be able to add an instance toNetwork
- make the radio be able to tune to a station
- give the
Network
a maximum number of items that can be connected to it - add a method to our
Network
to tell how many many free connection 'slots' there are. - modify the
connect()
method in theNetwork
class so that it will check if there are any free slots before a device can connect.
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
# Meet the Beatles: | |
beatles = [ | |
{"name": "John Lennon", "birth_year": 1940, "death_year": 1980, "instrument": "piano"}, | |
{"name": "Paul McCartney", "birth_year": 1942, "death_year": None, "instrument": "bass"}, | |
{"name": "George Harrison", "birth_year": 1943, "death_year": 2001, "instrument": "guitar"}, | |
{"name": "Ringo Starr", "birth_year": 1940, "death_year": None, "instrument": "drums"} | |
] | |
# Use the `beatles` list above to answer the following questions: |
Part 1
Using a loop, and the following list:
ages = [5, 15, 64, 27, 84, 26]
- Find the sum total of the values in this list
- Find the average (mean) value of the items in the list
https://docs.python.org/3/tutorial/datastructures.html
Using the documentation for list methods, complete the following tasks:
Add "Queen Street" to the start of the list
Find out what index "Croy" is at in the list
Add "Polmont" at the appropriate point (between "Falkirk High" and "Linlithgow")
stops = ["Croy", "Cumbernauld", "Falkirk High", "Linlithgow", "Livingston", "Haymarket"]
You are tasked with creating an e-commerce platform. Your online store may sell anything you wish. It could be a niche, boutique store or a more general 'amazon' type. Customers will log in, add items to their basket and purchase them.
Your shop should include; A stock class with quantity, price and availability.
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 THIS SCRIPT AT YOUR OWN RISK | |
# Make sure your work is backed up / in version control. | |
# Quick and dirty script to recursively replace all | |
# headers of the format ###heading with ### heading. | |
# (Works through all .md files in the directory, and subdirectories) | |
filelist = Dir.glob("**/*.md") | |
for filename in filelist |
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
git archive -o latest.zip later-commit $(git diff --name-only earlier-commit later-commit) |
NewerOlder