Getting myself new challenge

Need to take myself through a new path in life. Learning programming and data analytics for the job. So serious that I’m going to get myself back to HKU in a couple of months (if the pandemic allows me to). Fuck. Harsh. Even for plain language like Python.

The following are some stupid lines I’m starting writing.  There are many talents here (or in Twitter) who are going to LOL reading those stupid Grade 13 programming lines (may be even lower):

1. Create a class and class function to calc. tax

class Parcel:
“""Parcel creates a class using two variables –landuse, and value"""
def __init__(self, landuse, value):
self.landuse = landuse
self.value = value

def assessment(self):
“""A class function to help calculate the tax rate based on variables landuse and value of  each class and return the value"""
if self.landuse == “SFR":
rate = 0.05
elif self.landuse == “MFR":
rate = 0.04
else:
rate = 0.02
assessment = self.value * rate
return assessment

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

2. Load the about script to generate objects, calc. tax, and print out:

import arcpy
from arcpy import env

env.workspace = “C:\Users\lakes\OneDrive\Documents\Lakeso\GISM5053\Lab05\Exercise12″

import parcelclass

“""Create an empty list parcelTaxList. Use SearchCursor to search the feature class parcel.shp"""
parcelTaxList = []
cursor = arcpy.SearchCursor(“parcels.shp") #cannot use da built-in function as it does not allow row function
for row in cursor:
fid = row.FID
landuse = row.LANDUSE
value = row.VALUE
myparcel = parcelclass.Parcel(landuse, value) #It’s where Parcel object is created for each row
mytax = myparcel.assessment() #It’s where tax ammount is calculated
parcelTaxList.append(fid) # parcelTaxList is filled with FID of parcels.shp.

“""Use while Loop to generate a print list of landuse, value, calc. tax ammount for each FID"""
i = 1
while i <= len(parcelTaxList):
print(i,landuse, value, mytax)
i = i+1

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

I know it’s stupid. But at least I get a better sense of myself, in the midst of pandemic (at the scale of like Moses’ Tenth Catas…. Twisting the definition of “First Born", adding a bit of statistical error to tune it with our modern epoch of science, it is  in every single sense a God Send Catas, if you believe in God).

Take care mate(s). Take care everyone. When I find something worth writing, I’ll be still lock myself in here. Bloggers are in general smarter than in IG, FB, and Twitter. So.

With lots of love

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google photo

您的留言將使用 Google 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s

%d 位部落客按了讚:
search previous next tag category expand menu location phone mail time cart zoom edit close