Learn Python with Python Video Tutorial Python Course Python Note Python Book Python PDF Django Flask Python
375 subscribers
65 photos
2 files
57 links
Download Telegram
Answer is 1. Because:

1️⃣.inner() function is defined inside outer(), but it has its own local variable x with the value of 2. Note that this inner x is different from the outer x.

2️⃣.inner() function is called inside outer(), but its return value (which is 2) is not stored or used in any way.

3️⃣.Finally, outer() returns the value of its own x, which is 1.

4️⃣.The print(outer()) statement calls outer() and prints the returned value, which is 1.
Answer is C.)

Simply, because there's no code inside the try block that raises an exception, the except block is not executed, and the code continues to print "3" after executing the try block.
👍1
As a web developer today, most of your works are related to APIs.

But most of developers don't actually understand what it is. 👀

When we talk about API, we are usually referring to Web API. 🌐

Web API (Application Programmatic Interface) can provide:

1. Resources, e.g. bus arrival time, restaurant ratings...
2. Services or microservices, e.g. converting coordinates into place names, creating QR codes...

With Web APIs, developers can then easily incorporate these building blocks into other web applications.

👩‍💻There's some features of different Web API, for example:

1. Public vs. private
- Public APIs are available to everyone, but may subject to licenses
- Private APIs are only available to internal developers

2. Free vs. premium
- Premium APIs may charge on-demand
- That's why there's also this term “API Economy”!

There's actually API marketplace and directory site, like
- RapidAPI
- ProgrammableWeb

Here's some example of public API that you can explore:

1. Google (developers.google.com/apis-explorer)

2. Facebook (developers.facebook.com/docs/apis-and-…)

3. Data portals of many cities (dataportals.org/search)And you also have to understand what is 'API endpoints'.

API usually provides endpoints as a URI to provide services.

And it needs to be static, without affecting applications built upon And that's why there's a standard for writing API called REST.

REST stands for 'REpresentational State Transfer'.

It's an architectural style of writing APIs.
Answer is 8 64

👉The code defines a Square class with a method getArea that calculates the area of a square using the side attribute.

👉An instance of the Square class is created which is obj, It has side = 8,

👉its area is calculated by calling getarea.