Answer To: Please complete the following exercises. · 12.1 (page 511) · XXXXXXXXXXpage 513) Develop your files...
Vicky answered on Dec 01 2021
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import requests"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"response = requests.get('https://www.python.org')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"b'\\n\\n\\n\\n\\n\\n\\n \\n \\n\\n
\\n
\\n\\n \\n \\n \\n \\n \\n\\n \\n \\n \\n \\n \\n\\n \\n\\n
\\n
\\n \\n\\n \\n
\\n\\n \\n
\\n
\\n
\\n
\\n
\\n
\\n\\n \\n \\n \\n \\n\\n \\n\\n \\n \\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n
\\n\\n
\\n
\\n
\\n
\\n\\n \\n\\n \\n \\n\\n \\n \\n \\n\\n\\n\\n\\n \\n\\n \\n Notice: While Javascript is not essential for this website, your interaction with the content will be limited. Please turn Javascript on for the full experience.
\\n
\\n\\n \\n\\n \\n \\n\\n \\n\\n \\n \\n Skip to content\\n
\\n\\n \\n \\n ▼ Close\\n \\n\\n \\n\\n
\\n \\n \\n Python\\n
\\n \\n \\n PSF\\n
\\n \\n \\n Docs\\n
\\n \\n \\n PyPI\\n
\\n \\n \\n Jobs\\n
\\n \\n \\n Community\\n
\\n \\n\\n\\n\\n \\n ▲ The Python Network\\n \\n\\n \\n\\n
\\n\\n \\n \\n \\n\\n \\n \\n
\\n\\n \\n Donate\\n \\n \\n ≡ Menu\\n \\n\\n \\n\\n Search This Site\\n \\n\\n \\n GO\\n \\n\\n \\n \\n\\n
\\n
\\n
\\n \\n A A\\n
\\n
Smaller
\\n Larger
\\n Reset
\\n \\n \\n \\n
\\n
\\n \\n Socialize\\n
\\n
Facebook
\\n Twitter
\\n Chat on IRC
\\n \\n \\n \\n
\\n \\n
\\n
\\n\\n \\n \\n \\n
\\n \\n \\n \\n \\n About\\n \\n \\n\\n
\\n \\n
Applications
\\n \\n Quotes
\\n \\n Getting Started
\\n \\n Help
\\n \\n Python Brochure
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n Downloads\\n \\n \\n\\n
\\n \\n
All releases
\\n \\n Source code
\\n \\n Windows
\\n \\n Mac OS X
\\n \\n Other Platforms
\\n \\n License
\\n \\n Alternative Implementations
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n Documentation\\n \\n \\n\\n
\\n \\n
Docs
\\n \\n Audio/Visual Talks
\\n \\n Beginner's Guide
\\n \\n Developer's Guide
\\n \\n FAQ
\\n \\n Non-English Docs
\\n \\n PEP Index
\\n \\n Python Books
\\n \\n Python Essays
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n Community\\n \\n \\n\\n
\\n \\n
Community Survey
\\n \\n Diversity
\\n \\n Mailing Lists
\\n \\n IRC
\\n \\n Forums
\\n \\n PSF Annual Impact Report
\\n \\n Python Conferences
\\n \\n Special Interest Groups
\\n \\n Python Logo
\\n \\n Python Wiki
\\n \\n Merchandise
\\n \\n Community Awards
\\n \\n Code of Conduct
\\n \\n Get Involved
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n Success Stories\\n \\n \\n\\n
\\n \\n
Arts
\\n \\n Business
\\n \\n Education
\\n \\n Engineering
\\n \\n Government
\\n \\n Scientific
\\n \\n Software Development
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n News\\n \\n \\n\\n
\\n \\n
Python News
\\n \\n PSF Newsletter
\\n \\n Community News
\\n \\n PSF News
\\n \\n PyCon News
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n Events\\n \\n \\n\\n
\\n \\n
Python Events
\\n \\n User Group Events
\\n \\n Python Events Archive
\\n \\n User Group Events Archive
\\n \\n Submit an Event
\\n \\n\\n\\n \\n \\n \\n \\n \\n \\n \\n\\n\\n \\n \\n\\n \\n \\n \\n\\n
\\n \\n >_\\n Launch Interactive Shell\\n \\n
\\n \\n\\n
\\n \\n \\n # Python 3: Fibonacci series up to n\\r\\n>>> def fib(n):\\r\\n>>> a, b = 0, 1\\r\\n>>> while a < n:\\r\\n>>> print(a, end=\\' \\')\\r\\n>>> a, b = b, a+b\\r\\n>>> print()\\r\\n>>> fib(1000)\\r\\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
\\n Functions Defined
\\r\\nThe core of extensible programming is defining functions. Python allows mandatory and optional arguments, keyword arguments, and even arbitrary argument lists. More about defining functions in Python 3
\\n
\\n \\n \\n # Python 3: List comprehensions\\r\\n>>> fruits = [\\'Banana\\', \\'Apple\\', \\'Lime\\']\\r\\n>>> loud_fruits = [fruit.upper() for fruit in fruits]\\r\\n>>> print(loud_fruits)\\r\\n[\\'BANANA\\', \\'APPLE\\', \\'LIME\\']\\r\\n\\r\\n# List and the enumerate function\\r\\n>>> list(enumerate(fruits))\\r\\n[(0, \\'Banana\\'), (1, \\'Apple\\'), (2, \\'Lime\\')]
\\n Compound Data Types
\\r\\nLists (known as arrays in other languages) are one of the compound data types that Python understands. Lists can be indexed, sliced and manipulated with other built-in functions. More about lists in Python 3
\\n
\\n \\n \\n # Python 3: Simple arithmetic\\r\\n>>> 1 / 2\\r\\n0.5\\r\\n>>> 2 ** 3\\r\\n8\\r\\n>>> 17 / 3 # classic division returns a float\\r\\n5.666666666666667\\r\\n>>> 17 // 3 # floor division\\r\\n5
\\n Intuitive Interpretation
\\r\\nCalculations are simple with Python, and expression syntax is straightforward: the operators +, -, * and / work as expected; parentheses () can be used for grouping. More about simple math functions in Python 3.
\\n
\\n \\n \\n # Python 3: Simple output (with Unicode)\\r\\n>>> print(\"Hello, I\\'m Python!\")\\r\\nHello,...