Python: default argument blunders

A few minutes ago a friend sent me the following code, and told me its misbehaving: def foo(l=[]): l.append(“hello!”) print(l) foo() foo() Instead of printing [“hello”] twice, it printed [“hello”, “hello”]. Any ideas why? what’s going on? I’ll… Read more

Similar

Scraping Flight Data with Python

Note:  The code for this project can be found in this github repo. I have been building a new project that requires the prices of flights.  I looked for APIs but couldn’t find any that were f…

Read more »