lst = [10, 4, 7, 8, 9, 13, 1, 0, 78, 5, 58]

lst.append(55)
lst

lst.remove(4)
lst

lst.reverse()
lst

lst.sort()
lst

"""
Explanation: Python Objects and Their Use
With today's lesson we will start learning object oriented in Python by introducing Objects in Python. 

Objects are the fundamental component of object-oriented programming.

In this lesson we will discuss about the Objects only, in later lectures I will introduce you the Object Oriented Python. 

All objects have certain attributes and behavior.

Let's examine the real life example: Our object is a Car;
Attributes:

It's color
Number of miles driven
current location

Behaviours:

Driving the car (Change the miles driven, change location)
Painting the car (Changing the color)

In similar fashion, Objects in computer science contains a set of attributes, stored in a set of instance variables, and a set of functions called methods that provide its behaviour. 
For instance, when we talked about lists, we mentioned sort(list) function. It's a procerdural programming approach with two distinct entities a sort function and a list to pass it. 
But in Object-oriented programming approach, the sort routine would be part of the object containing the list like other methods for lists;

append(x)
remove(x)
reverse()
sort()
End of explanation
"""


n = 10
id(n)

k = 10
id(k)

s = 20
id(s)

"""
Explanation: In Python, objects are represented as a reference to an object in memory.
A reference is a value that references, or “points to,” the location of another entity.T hus, when a new object in Python is created, two entities are stored—the object, and a variable holding a reference to the object. All access to the object is through the reference value.
We can get the reference value of a variable (that is, the location in which the corresponding object is stored) by use of built-in function id.
End of explanation
"""


def numPrimes(start, end):
    """ Returns the number of primes between start and end. """
    return 0

print(numPrimes.__doc__)

"""
Explanation: After introducing the basic concept of objects, now we can continue exploring Python. In this section we will look at what is modular desing, why is important and how to do it in Python
Modular Design
Modular Design for Orbiter Flight Computer Software:

An important aspect of well-designed software is that programs are designed as a collection of modules. The term “module” broadly speaking, refers to the design and/or implementation of specific functionality to be incorporated into a program.While an individual function may be considered a module, modules generally consists of a collection of functions (or other entities).
Every module needs to provide a specifi cation of how it is to be used. This is referred to as the module’s interface.
A docstring is a string literal denoted by triple quotes given as the first line of certain program elements.
End of explanation
"""


import math
factortial(5)

import math 
math.factorial(5)

"""
Explanation: A Python module is a file containing Python definitions and statements. 
The Python Standard Library contains a set of predefined standard (built-in) modules.



A namespace provides a context for a set of identifiers. Every module in Python has its own namespace. 
A name clash is when two otherwise distinct entities with the same identifier become part of the same scope.




With the import modulename form of import in Python, the namespace of the imported module becomes available to, but does not become part of, the namespace of the importing module.
End of explanation
"""


from math import factorial
factorial(5) # Works but vulnerable to name clashes

def factorial(n):
    print('my factorial function')

factorial(5) # It's not what I wanted

math.factorial(5)

from math import factorial as fact
fact(5)

def factorial(n):
    print('my factorial function')

factorial(5)

fact(5)

"""
Explanation: The  "from-import" Form of Import
With the from-import form of import, imported identifiers become part of the importing module’s namespace. Because of the possibility of name clashes, import modulename is the preferred form of import in Python.
End of explanation
"""


