Intermediate
Make options keyword-only
Write connect(host, *, port=80, secure=False) that returns the text http:// + host + : + port, for example http://a.com:80. When secure is true it starts with https:// instead.
The starter has no * yet. Add it, as shown, so that port and secure must be named in a call. Then connect("a.com", 8080) must raise TypeError.
What Check tests
connect("a.com")returnshttp://a.com:80- Keywords work
- A positional port raises TypeError
- A positional secure flag raises TypeError
- The host can still be a keyword
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.