Write a function to add two numbers - and invoke it
Modify the function so that the expected argument is a tuple of two numbers
Create a list of such tuples e.g. coords = [ (3,4), (12, 13), ...]
Iterate through the list to generate a list of distances from the origin (use Pythagoras)
- use a for loop
- use a list comprehension
- (advanced) use map() and a lambda function
Get a free OpenAI API key or Google Gemini Key. You may need to sign up.
Run the quickstart example to chat with the model.
Modify the quickstart so ask the model one of the Python questions in this exercise
Set up a GitHub Codespaces session. This uses the VSCode editor.
Copy over some code from your Colab notebooks and run these in VSCode
Compare and contrast the two editors. Which do you prefer?
- What is the difference between .py and .ipynb files?
- Show how to run code in each type
Python has many famous packages. Explore some of these.
For each package, write a tiny script that shows its capabilities.
Explain - What is a Python environment? Why are they used? What is pip?
Show the packages listed in your environment
Install a package not already in your environment e.g. cowsay. Test that it is has been installed, imported and is working properly?
Hugging Face is The GitHub for AI models. Go to the Hugging Face website and explore the models, spaces, tasks and datasets.
Look at the model of some models in particular
Click on the "Use this model" button to see the Python code. Copy this and use to get a basic result.
Give a overview demo to the class.
The Open Notify API server has an public API to list people in space here
Use this API to write the astronauts (first name, last name) in the ISS to a CSV or Excel file.