Functions contd
- Refer Here for functions examples
modules in python
- module is a file in python
- lets say we create a file called as
utils.pythen utils is the module name - python functions, classes and variables defined in the modules can be imported in other modules.
- A python file can be executed directly
python euler3.pythen we will be executing the python code and other way is usingimport - In python whenever you see anything around double underscores it has special purpose these are considered as dunder methods or member
- the case of special variable
__name__.- This variable will have module name if imported
- This variable will contain value
__main__if the user executed this python file
- Refer Here for shebang based version of python
Generators in python
- Refer Here for samples
Exercise: Create two functions
- function to return total amount after simple intrest
- function to return compound interest
- call these functions with different values
- Refer Here for solutions
String methods
- ASCII and Unicode
- Text encoding:
- We have text encoding
UTF-8andUTF-16
- We have text encoding
- Refer Here for python strings
- String interpolation: Refer Here
- Keywords are words with special meanings in python so you cannot create any names with the keywords Refer Here
- Refer Here for functions, text and keywords examples
