Wednesday 12 December 2018

CODING & MENGENALI PYTHON

Muat turun Python (ikut spesifikasi yang ditetapkan)

Muat turun editor - VisualStudio Code, Sublime Text atau notepad pun boleh.

KODING DAN MENGENALI PYTHON


Rujukan : Senarai kata kunci PYTHON


TUTORIAL CODING WITH PYTHON SAMPLE -01



# def multiply((a, b):
#     return a*b


# multiply([2, 3, 4, 5])


# def multiply((a, b):

#     return a*b


# multiply(2, 3, 4, 5)


def multiply(*list):
    total = 1
    for number in list:
        total *= number
    return total


print(multiply(2, 3, 4, 5))

---------------------------------------
OUTPUT
--------------------------------------
ctl+alt+N - Visual studio Python output

[Running] python -u "z:\hack\python\cobaan29.py"
120

[Done] exited with code=0 in 0.205 seconds










TUTORIAL CODING WITH PYTHON SAMPLE -02


numbers = [1, 2, 3]


def increment(number: int, by: int = 1) -> tuple:
    return (number, number + by)


print(increment(2, by=3))  # keyword argument


---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\cobaan28.py"
(2, 5)

[Done] exited with code=0 in 0.203 seconds









TUTORIAL CODING WITH PYTHON SAMPLE -03

numbers = [1, 2, 3]


def increment(number: int, by: int = 1) -> int:
    return (number, number + by)


print(increment(2, by=3))  # keyword argument


---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\cobaan27.py"
(2, 5)

[Done] exited with code=0 in 0.248 seconds






TUTORIAL CODING WITH PYTHON SAMPLE -04


numbers = [1, 2, 3]


def increment(number, by):
    return (number, number + by)


print(increment(2, by=3))  # keyword argument

---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\cobaan26.py"
(2, 5)

[Done] exited with code=0 in 0.202 seconds





TUTORIAL CODING WITH PYTHON SAMPLE -05


# def increment(number, by):
#     pass #indentation


# print(increment(2,3))


#

def increment(number, by):
    return (number, number + by)


print(increment(2, 3))

---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\cobaan25.py"
(2, 5)

[Done] exited with code=0 in 0.259 seconds









TUTORIAL CODING WITH PYTHON SAMPLE -06


# def increment(number, by):
#     pass #indentation


# print(increment(2,3))


def increment(number, by):
    return number + by


print(increment(2, 3))
---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\cobaan24.py"
5

[Done] exited with code=0 in 0.262 seconds






TUTORIAL CODING WITH PYTHON SAMPLE -07


# names = ["Ahmad", "Kabir"]
# for name in names:
#     if name.startswith("A"):
#         print("Found")
#         break

# names = ["Ahmad", "Kabir"]
# found = False
# for name in names:
#     if name.startswith("A"):
#         print("Found")
#         found = True
#         break
# if not found:
#     print("Not found")

# names = ["Ahmad", "Kabir"]
# found = False
# for name in names:
#     if name.startswith("J"):
#         print("Found")
#         found = True
#         break
# if not found:
#     print("Not found")

#change statement with else
names = ["Ahmad", "Kabir"]
for name in names:
    if name.startswith("J"):
        break
else:
    print("Not found")

---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\cobaan23.py"
Not found

[Done] exited with code=0 in 0.233 seconds









TUTORIAL CODING WITH PYTHON SAMPLE -08


# loops 2 types, for nad while

# for
# while

# for x in "Phyton":
#     print(x)
# for y in "123456789":
#     print(y)

# for j in ["a", "b", "c"]:

#     print(j)

# for k in range(5):
#     print(k)

# for l in range(2, 5):
#     print(l)

# # skip by 2
# for m in range(0, 10, 2):
#     print(m)

print(range(5))

# LIST
print(type(range(5)))
print([1, 2, 3, 4, 5])
---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\tempCodeRunnerFile.py"
range(0, 5)
<class 'range'>
[1, 2, 3, 4, 5]

[Done] exited with code=0 in 0.237 seconds












TUTORIAL CODING WITH PYTHON SAMPLE -10


umur = 22
if umur <= 18:
    message = "Layak"
else:
    message = "Tidak "
    print(message)

    # chaining operation operator = can be simplified
message = "Layak" if umur >= 18 else "Not eligible"

---------------------------------------
OUTPUT
--------------------------------------
[Running] python -u "z:\hack\python\tempCodeRunnerFile.py"
Tidak layak

[Done] exited with code=0 in 0.276 seconds








TUTORIAL CODING WITH PYTHON SAMPLE -11



umur = 22
if umur <= 18:
    message = "Layak"
else:
    message = "Tidak layak"
    print(message)

    # chaining operation operator

---------------------------------------
OUTPUT
--------------------------------------

[Running] python -u "z:\hack\python\cobaan20.py"
Tidak layak

[Done] exited with code=0 in 0.231 seconds




**********************************************



Rujukan : Senarai kata kunci PYTHON





Monday 19 November 2018

FUN HAVING AND TALKING TO INTERNS

I need nerds - single minded tech nerds.

It was fun having and talking to Computer Science interns on programming (writes code). Lot of buzz words. I cant understand many of them.


"Can't read the code that I wrote"? ..The codes are not meant to be read, It is meant to be run and understood by the machines.


Here we don't do syllabus ten years ago down the road. We adopt current time syllabus. Coder don't need education. They just need to understand the machine to run codes.

Saturday 3 November 2018

MALAYSIA BUDGET 2019 HIGHLIGHTS

MALAYSIA BUDGET 2019 HIGHLIGHTS - 2ND NOVEMBER, 2019
Themed 'Malaysia Wibawa, Ekonomi Dinamik, Rakyat Sejahtera',
3 focus areas.
12 main strategies to return Malaysia's economic position as an Asian Tiger.
Focus 1 : Implement institutional reforms.
Focus 2: Ensure people's well-being.
Focus 3: Nurture a culture of entrepreneurship.
1Govt real debt and liabilities as at end-June 2018 stood at RM1.065 trillion, which is RM350 billion more than the official sum revealed by the previous government
2Govt forecasts 2019 GDP growth at 4.9% despite global economic landscape uncertainty
3Govt real debt and liabilities as at end-June 2018 stood at RM1.065 trillion, which is RM350 billion more than the official sum revealed by the previous government
4Govt forecasts 2019 GDP growth at 4.9% despite global economic landscape uncertainty
5Govt discovered that the previous administration had secretly paid nearly RM7 billion to settle 1MDB’s debts as of April 20, 2018
6Govt may need to pay another RM43.9b to settle 1MDB debt
7Govt will take action to recover funds lost or stolen from 1MDB
81MDB, Malaysian govt won't pay the balance US$4.32b to IPIC and Aabar but will seek return of US$1.46b paid
9Govt to start receiving international bids for superyacht Equanimity within one month from Nov 5, 2018
10RM60b MRT3 project deferred till MRT2 is completed
11Klang Valley Double Track Project worth RM5.2b will be re-tendered via open tender, which is expected to bring bigger cost savings
12Govt will table the Fiscal Responsibility Act in 2021 to prevent uncontrolled spending that causes super huge debts
13Govt will pursue PPP model for land transactions via open tender
14Govt will sell lands on scheduled and staggered basis to the highest bidder to maximise govt revenue
15Govt to renegotiate direct or limited tender contracts worth RM19b, with a minimum cost-cutting target of 10% or RM1.9b
16Govt to set up Airport Real Estate Investment Trust to obtain up to RM4b funding via 30% equity sale
17Govt to introduce Government Procurement Act in 2019 to ensure transparency and open competition, accompanied by open tender practices and punitive action for any abuse of power in relation to contract issuance
18Govt will introduce a credit system for sales tax deductions from Jan 1 to avoid double-taxing and lower business costs
19Services tax will be imposed on imported services
20Govt plans to implement scheduled land sales to the highest bidders subject to land conditions to maximise govt revenue
21Govt to propose departure levy be imposed on air travellers leaving the country from June 1, 2019
22Govt plans to impose departure levy of RM20 on travellers flying to Asean; RM40 on those going to other countries
23Rate of stamp duty on property transfer worth more than RM1m will be raised by 1% from 3% to 4%
24Only 545 items were zero-rated under GST, while under SST, almost 10 times more items are exempted from sales tax
25Govt will launch a Special Voluntary Disclosure Programme to allow taxpayers to voluntarily declare any unreported income
26For locals and PRs, a 5% real property gains tax will be imposed, from 0% now
27This is for the disposal of properties in the 6th year and beyond, from the date of purchase.
28The tax is exempted for lands, as well as low-cost and affordable housing under RM200,000.
29For companies and foreigners (non-PRs), real property gains tax to be doubled to 10%.
30This is for the disposal of properties in the 6th year and beyond, from the date of purchase
31Annual gaming licence fee for casinos to be raised from RM120m to RM150m; gaming tax on casinos to be raised to 35% of GGR
32Gaming machine dealer's licence to be raised from RM10,000 to RM50,000 per year; tax on gaming machines also up from 20% to 30% of gross collection
33Putrajaya to collect RM261.8b revenue in 2019, including RM30b special dividend from Petronas
34Single vehicle/motorbike owners with engine capacity 1500cc and below to get targeted fuel subsidy
35Govt to give RON95 petrol subsidy amounting to 30 sen/litre, limited to 100 litres/month for cars; and limited to 40 litres/month for motorbikes
36Measures to bump up govt revenue by RM1.43b
37An estimated 4.1 million households to continue receiving financial assistance from govt via a RM5b allocation
38Households with monthly income of RM2,000 and below to receive RM1,000 financial assistance
39Households with monthly income of between RM3,001 and RM4,000 to receive RM500 financial assistance
40Govt proposes to raise minimum wage to RM1,100 in Malaysia from Jan 1, 2019
41Govt proposes reduction of employers' EPF contribution for workers aged 60 and above to 4%, to encourage employment for Malaysians aged 60 and above
42Govt, in cooperation with private insurance company, to introduce National Health Protection Fund B40
43B40 fund will provide free coverage on 4 critical illnesses up to RM8,000, and wage replacement during hospital treatment at RM50/day or RM700/year
44Labour laws to be reviewed to strengthen the labour market and workers' welfare, and totally prohibit discriminatory practices by employers
45One-off assistance of RM500 to be paid to eligible pensioners
46Excise duty of 40 sen/litre to be imposed on 2 categories of packaged sweet drinks from Apr 1
471st category: Drinks with additional sugar/sweetener with over 5g of sugar per 100ml; and
482nd category: Fruits and vegetable drinks with over 12g sugar per 100ml
49REHDA agrees to cut house prices by up to 10% on new projects
50To ensure ex-offenders are not left behind and contribute to the economy, businesses that employ them will be rewarded with extra tax cuts
51Govt to allocate nearly RM29b for health services, up 7.8% y-o-y
52Internal security, national defence to be beefed up via RM5.9b development allocation to home affairs and defence ministries
53RM500m will be allocated to the Public Transport Fund in the form of subsidy rate of 2% for taxi and bus firms and public transport operators
54No toll hike in 2019, which will cost the govt about RM700m in potential revenue loss
55RM400m allocated to maintain, improve govt quarters
56Tax proposed on online services from Jan 1, 2020; will include transaction on software, music, and online advertising
57National Fiberisation and Connectivity Plan to get RM1b allocation
58Govt allocates RM210m for years 2019-2021 to encourage Industry 4.0 transition
59Tax relief to be given to companies that help their employees settle their PTPTN study loans in 2019 tax year
60Khazanah to develop 80-acre plot in Subang as a world-standard aerospace hub
61Film in Malaysia Incentive (FIMI) to get RM30m allocation; Khazanah to also provide additional RM100m to FIMI for production at Pinewood Iskandar Malaysia Studios
62Govt to continue providing scholarships, study loans via RM3.8b allocation, of which RM2b is reserved for MARA-sponsored Bumiputera students
63Govt to establish a national Debt Management Office which will be responsible to review and manage govt debts and liabilities, and to monitor new debt issuance by government, statutory bodies and special purpose vehicles
64From Jan-Aug 2018, RM61.6b worth of investments approved vs RM40.4b in the same period last year
65RM20m will be spent on Buy Malaysian Product Campaign to support local products and services
66RM100m earmarked to prepare Malaysian athletes for 2020 Tokyo Olympics
67Govt to designate 380 acres of land in Pulau Indah, Selangor as free trade zone to support and catalyse shipping and logistics activities in Port Klang
68Govt to turn Pangkor island into a duty free zone
69RM30m allocated to help small palm oil plantation estate holders to obtain MSPO certification
70Govt will allow property crowdfunding driven by the private sector as alternative for purchase of first home and supervised by the Securities Commission
71New framework to approve and monitor buy-and-sell of digital tokens and currencies will be gazetted in early 2019
72RM2.46b will be allocated to upgrade railway tracks
73RM100m allocated to TEKUN to finance small entrepreneurs in 2019
74MoF to helm special Special Task Force to review role and function of MoF-owned firms and statutory bodies to avoid duplication, direct competition with private sector
75Govt to continue with Pan Borneo Highway project, subject to a cost-rationalisation study
76The project in Sabah and Sarawak will include development and upgrading of roads ans well as water and electrical infrastructure, health and education facilities, and the development of their respective economic corridors
77RM314.5b allocated for Budget 2019 versus estimated RM290.4b for 2018
78RM259.8b allocation for operating expenditure, RM54.7b for development expenditure
79Under development spending, economic sector (transport, commerce, industry, energy, public utilities and agriculture) gets RM29.2b allocation; social sector gets RM15.2b, while security gets RM7.1b; public administration gets RM3.2b
80RM20m allocated to Malaysia Healthcare Tourism Council (MHTC) to team up with leading private hospitals, to boost Malaysia's image as a health tourism destination
81RM2b proposed to encourage investment in green technology industries
82Japanese govt offers to guarantee up to 200b yen or RM7.4b of Samurai bond issuance with 10-year tenure
83The issuance will be guaranteed by the Japan Bank of International Cooperation at a coupon rate of 0.65% and is expected to be issued before March 2019.
84Govt to raise MACC allocation by 18.5% to RM286.8m from RM242.1m
85The commission's manpower to be beefed up with 100 more staff next year
86Corporate tax rate will be reduced to 17% from 18% for SMEs with paid capital below RM2.5m and businesses with annual taxable income below RM500,000
87RM240m allocated to introduce a RM100 unlimited public transport pass, to start with the rail and RapidKL bus networks from Jan 1, 2019
88RM50 monthly pass just for RapidKL bus services, expanded to other bus companies