# data[].attributes.body
while True:
    i = 0
    try:
        max_records = int(input("Enter max number:"))
        i = 1/max_records
    except ValueError:
        print("Error, please enter number not letters!")
        i=1
    except ZeroDivisionError as arg:
        print(arg)
    except:
        i=1
        print("Your program encountered Error!!")
    else:
        print("Maximum number of record is:{}".format(max_records))
        break
    finally:
        if i==1:
            print("For feedback please contact our support Tel:6111 1111")

# data[].attributes.body
class NumberNotInRange(Exception):
    def __init__(self, arg):
        self.arg = arg

    def __string__(self):
        return arg


while True:
    i = 1
    try:
        max_number = int(input("Enter max number of records:"))
        i = 1/max_number
        if max_number < 0 or max_number >99:
            raise NumberNotInRange(max_number)

    except ValueError:
        print("Error in input!! Please enter whole number between 1 to 99")
        continue
    except ZeroDivisionError as arg:
        print("Error ", arg)
        i = 1
    except NumberNotInRange as arg:
        print("Number between 1 to 99 ")
        continue
    except:
        print("You have encountered a problem!!")
    else:
        print("Maximum records is: {} and i is {}".format(max_number, i))
        break
    finally:
        if (i == 1):
            print("Contact Support Tel: 6111 1111")

print("Outer Loop statement")

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 7 -Dealing with Exceptions

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 6 -Writing Code to Process Files and Directories) ver 0.2

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 5 -Structure Code for ReUse) ver 0.3(remove unnessary slides)

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 4 - Conditional Statement and Loops) ver 0.2

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 3-ListDictionaryTuples) ver 0.2

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 2-DataTypes) ver 0.2

# data[].attributes.attachment_link.title
NICF-Intro to Python(Module 1 -Setting Up Python Environment ver 0.3

# data[].attributes.body
1) https://pythonprogramming.net/navigating-pages-scraping-parsing-beautiful-soup-tutorial/?completed=/introduction-scraping-parsing-beautiful-soup-tutorial/
2) Build your own BeautifulSoup web scraper - D:\Python Resource\ (Very good resource)

# data[].attributes.body
Day 1
1) I have photocopied LO Python Activities 1-2, 1-3 and 1-4.   Activities 1-4 is to check for errors and the file is wordcount1.py.  If possible tried to integrate this as part of the exercise sheets.
2) I make a mistake trying to describe dictionary as part of the unordered list.
So I mentioned tt for loop is only for ordered collections and not for unordered collections.  But the subsequent slides actually show that you can retrieve dictionary using a for loop.
3) I almost forgot during class how to create a for loop:
for i in range(10):
print(i) #will print 0 to 9

for i in range(1,11)
print(i)   # will print 1 to 10

4) Also made a mistake saying that block comments can be used using /*  ..... */
which I think its only using # -- inline comment or """ doc string comment """

Day 2 :
for Day 2, I have tried to correct the shutil examples by adding for lines of code:
like:
I will use:
path=os.getcwd() and os.mkdir(path + "/folder2") before we perform:
shutil.copy("hellloworld.txt", "folder2").
Also I use the examples of LO to check if the directory exists using:
os.path.isdir(....) and os.path.isfile() to proof check the shutil.code.
I should add examples like glob which helps to search for a certain file extension in the directory.  Cross reference glob

The class ended with 4 issues:
1) I had problems getting the telegrambot working because pip install telepot met with error prompt Visual C++ 14.0 is required , and a multidict installation error. Soln: fallback to python interpreter 3.6.2
2) i am not able to demo successfully telegrambot because there are many versions of botfather and also I didn't run in on the cloud.  Try AWS lambda but couldn't get it work.  Soln: Run it on pythonanywhere but need to purchase a $5/mth plan to get it working.
3) Students are not convinced with webscraping how it works.  So I decide to show them how to webscrap the whole web site, but get into issue the next day by trying to show them how to pull down item-title(which is product title).  Problem is on the web page there are 4 item-titles, so I need a way to understand which item-title will show which product-pricing.
4) I have created Git repositories as following:
https://github.com/itenabler-python/PythonDay1.git
https://github.com/itenabler-python/PythonDay2.git
tried on my computer Pycharm can clone git successfully.  But showhow some students and also my instructor computer cannot get it to clone successfully.  Need to troubleshoot.

Day 3
1) found solution for import teleport error for bot_01.py and bot_02.py.
Although pip install prompt Visual C++ 14.0 is required, there is no Visual c++ 14.0 redistributable as download.  I have tried downloading Visual C++ 15(x86 32-bit) and (x64) version to try to troubleshoot the problem.
Finally conclusion is to fallback on installing python interpreter 3.6.2 as this is my laptop version and it work quite well even I have change my instructor version, it work fantastic

I have presented the code for pdf and chart poorly, as I did not read ahead the codes.
Need to work on reading the codes ahead and better presentation.

Some breakthrough:
1) Now I know why Python is commonly used because the interpreter is installed in machines Linux, Mac, Raspberry Pi, etc.  Only Windows machine are not preinstalled with Python Interpreter
2) Interpreted Lanuage means -> python helloworld.py  # will work
Java is a compiled lanaguage -> you need to compile then run
javac helloworld.java -> java helloworld.class

3) You can run python scripts in the cloud easily using PythonAnywhere.  I should develop a program to web scrape Example a 4D toto web site.

# data[].attributes.body
print(os.getcwd())

for file in os.listdir():
    # print(file)
    templist = file.rsplit(".",1)
    if len(templist) > 1:
        print(templist[0])

# data[].attributes.body
import shutil
import os
print(os.getcwd())
path=os.getcwd()
os.mkdir(path + "/folder2")
shutil.copy('hello.txt', 'folder2')
#
shutil.copytree("folder2", "folder2_backup")
#
os.mkdir(path + "/folder2/anotherfolder")
shutil.move("folder2/hello.txt", "folder2/anotherfolder/hello.txt")
#
shutil.move("folder2/anotherfolder/hello.txt", "folder2/anotherfolder/newhello.txt")

# data[].attributes.headline
Compile functions into python file and import into other files 

# data[].attributes.subject
Compile functions into python file and import into other files 

# data[].attributes.body
/* calculateBMI.py */

def calculateBMI(height, weight):
    height = height/100
    return (weight)/(height ** 2)

/* create a test file and ask for inputs for BMI calculate *?

from calculateBMI import *

name = input("Enter your name:")
height = float(input("Enter your height in cm:"))
weight = float(input("Enter your weight in kg:"))

myBMI = calculateBMI(height,weight)
print(myBMI)

# data[].attributes.body
/* hello4.py */
print("hello world")

/* hello5.py */ /* remember although your filename is hello4.py but when import omit the .py extension
import hello4   #and run hello5.py it will run but there is no pyc file in the directory

/* to create the pyc file - use python -m compile
/* new - pyc file will be auto generated in __pycache__ when you run python05.py
/* there will be a hello4.cpython-36.pyc create in __pycache__
/* rename this hello4.cpython-36.pyc to hello4.pyc same path as hello5.py it will run
/* note that even though pycharm show an curly red line of the import of pyc module when in your python program but the program will run in pycharm and also the terminal window

# data[].attributes.body
1) Python Tinker GUI
2) Python -  Create Instagram Bot
3) Python Assessment file - WQ

# data[].attributes.body
1) Windows 7 must be updated to SP1 (pick x64  instead of IA64-OLD)
2) In case after installing Win7SP, still encounter error because need an update which is KB2533623.  I have copied this to D:\RP-PYTHON\Python Install
3) In case there is a api-ms-win-crt-runtime error, uninstall the Visual C++ Redistributable for VS2015, it could be the file is not x64 bit. Reinstall and reboot the machine.

# data[].attributes.body
1) Learn Python  GUI - Tinker
2) Learn Python - Create Instagram Bot
3) Python file I/O
4) Python Excel speadsheet
5) Python create pdf
6) Python create word files
7) Python web scraping
8) Python Assessment file

# data[].attributes.body
1) http://tiny.cc/dtw8fz - where you can download
Day1, Day2 and Pycharm Installation Guide.
2) https://github.com/jason-lim/PythonDay2  - Python Source code