Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Thursday, 27 March 2025

Work Diary - 2025

Date

Link

28.01.2025

https://ametodl.blogspot.com/p/experience-with-deepseek-r1.html

02.02.2025

https://ang-19-tutorials.blogspot.com/2025/03/1-angular-19-tutorials.html

03.02.2025

https://ang-19-tutorials.blogspot.com/2025/03/64-side-nav-bar-demo.html

03.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/1-angular-19-tutorials.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/62-template-form-validation.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/5-session-4-routing-navigation-2-hours.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/62-template-form-validation.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/63-reactive-form-validation.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/64-side-nav-bar-demo.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/6-session-5-forms-validation-2-hours.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/7-crud-in-angular-19.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/7-crud-made-simple.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/80-sqlite-installation.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/81-sqlite-tutorial-basics.html

04.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/82-sqlite-crud-advanced-topis.html

07.02.2025

https://dockerhandson25.blogspot.com/2025/02/ai-agent-basics-hands-on.html

07.02.2025

https://gamma.app/docs/Pydantic-AI-Agents-Making-AI-Work-for-You-sbulct84mtrt9db

12.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/10-input-decorator-concepts.html

12.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/11-output.html

12.03.2025

https://ang-19-tutorials.blogspot.com/2025/03/9-signals.html

13.01.2025

https://learn-gemini2.blogspot.com/2025/01/

13.03.2025

https://type-script-tutorials.blogspot.com/

14.03.2025

https://gcp-handson.blogspot.com/2025/03/run-ollama-in-co-lab.html

15.02.2025

https://ametodl.blogspot.com/2022/11/angular-1-installation.html

15.02.2025

https://ametodl.blogspot.com/2022/11/angular-2-string-interpolation.html

15.02.2025

https://ametodl.blogspot.com/2022/11/angular-3-directives.html

15.02.2025

https://ametodl.blogspot.com/2022/11/angular-4-routing.html

16.02.2025

https://ametodl.blogspot.com/2022/11/angular-5-with-json.html

16.02.2025

https://ametodl.blogspot.com/2022/11/angular-6-ngclass.html

16.02.2025

https://ametodl.blogspot.com/2022/11/angular-7-service.html

16.02.2025

https://ametodl.blogspot.com/2022/12/angular-8-forms.html

16.02.2025

https://ametodl.blogspot.com/2022/12/ionic-angular-1-demo.html

16.02.2025

https://ametodl.blogspot.com/2024/12/academic-paper-pipeline.html

18.02.2025

https://learn-gemini2.blogspot.com/2025/02/temp-angular-for-immss.html

19.02.2025

https://angular.dev/tutorials/learn-angular/1-components-in-angular

19.02.2025

https://candwebapp2024.blogspot.com/2025/01/3-sass.html

20.02.2025

https://angular-material.dev/articles/angular-material-theming-system-complete-guide

20.02.2025

https://learn-gemini2.blogspot.com/2025/02/angular-material-theming-color.html

20.02.2025

https://material.angular.io/guide/getting-started

20.02.2025

https://material.angular.io/guide/theming

21.02.2025

https://learn-gemini2.blogspot.com/2025/02/angular-material-typography.html

21.03.2025

https://gcp-handson.blogspot.com/2025/03/1-k8s-intro-lab.html

22.02.2025

https://learn-gemini2.blogspot.com/2025/02/deep-seek-in-colab.html

23.01.2025

https://hugfacehandson.blogspot.com/

23.01.2025

https://ollamabasic.blogspot.com/2025/01/local-llm-for-immss-ai.html

23.02.2025

https://gcp-handson.blogspot.com/2025/02/gcp1.html

24.03.2025

https://qc-python-basics.blogspot.com/2025/03/1-popular-python-libraries-for-quantum.html

25.03.2025

https://gcp-handson.blogspot.com/2025/03/temp-for-discussion.html

26.03.2025

https://civil-engg-ai.blogspot.com/2025/03/pyautocad-intro.html

27.02.2025

https://gcp-handson.blogspot.com/2025/02/caai-33-git-docker-push-for-frontend.html

27.02.2025

https://github.com/au60rmc/immibizsoft-frontend

27.03.2025

https://auto-fill-form.blogspot.com/2025/03/2-devops-beginners-hands-on.html

27.03.3025

https://dev-ops-hands-on.blogspot.com/2025/03/1-devops-basics-hands-on.html

26.03.2025

https://auto-fill-form.blogspot.com/2025/03/1-basic-form-filling-using-selenium.html

04.05.2025

https://learn-gemini2.blogspot.com/2025/05/builderio-tutorials.html

05.05.2025

https://tnsche-sirf.blogspot.com/2025/05/1-nirf-overall-discrepancies.html

12.05.2025

https://tnsche-sirf.blogspot.com/2025_05_12_archive.html

14.05.2025

https://tnsche-sirf.blogspot.com/2025/05/skills-in-demand-2025-from-job-web-sites.html

16.05.2025

https://tnsche-sirf.blogspot.com/2025/05/10-prominent-itites-industries-in.html - 

17.05.2025

https://tnsche-sirf.blogspot.com/2025/05/skills-in-demand-2025-from-job-web-sites.html                                                                            

18.05.2025      

https://out-come-based-education.blogspot.com/2025/05/obe-training-modules.html

 May 2025 

https://tn-phd-ecosystem.blogspot.com/

01.08.2025 

https://tnsche-sirf.blogspot.com/

03. 07.2025  

https://july2025-works.blogspot.com/

30.05.2025

https://out-come-based-education.blogspot.com/

02.06.2025 

https://p-e-p-2025.blogspot.com/

02.08.2025

https://ai-drug-discovery.blogspot.com/

23.08.2025  

https://py4civil.blogspot.com/    

2018            

https://github.com/aurmc2018/hello-world

 

https://github.com/TANSCHEC/sirf.git

23.10.2025

Python Concept-s Revisit

18.09.2025

https://rmc-wp.blogspot.com/

30.09.2025

https://ui-basics.blogspot.com/2025/08/1-html-css-jss-using-code-pen.html

23.09.2025

Dockerization 230925 backend for Maran

03.10.2025  

Polar Vs Pandas 

08.10.2025  

AI Use Case #1 

17.10.2025  

Deiva Web1 https://urbannomad-cloud-web-k2sw.bolt.host/ 

17.10.2025  

Deiva Web2 https://eokquevr.dora.run/ 

25.10.2025  

RMC Web1 https://l-earn-forge.lovable.app

27.10.2025  

Git Repository Tutorials 

12.11.2025  

Word Press Plugin Tutorials 


Tuesday, 8 March 2022

Python#07

Class in Python

A Class in Python is a logical grouping of data and functions. It gives the freedom to create data structures that contains arbitrary content and hence easily accessible.

Class” is a logical grouping of functions and data. Python class provides all the standard features of Object Oriented Programming.

Class inheritance mechanism :  A derived class that override any method of its base class. A method can call the method of a base class with the same name. Python Classes are defined by keyword “class” itself. Inside classes, you can define functions or methods that are part of the class

Everything in a class is indented, just like the code in the function, loop, if statement, etc.

The self argument in Python refers to the object itself. Self is the name preferred by convention by Pythons to indicate the first parameter of instance methods in Python

Python runtime will pass “self” value automatically when you call an instance method on in instance, whether you provide it deliberately or not

In Python, a class can inherit attributes and behavior methods from another class called subclass

class ametClass():
def aMethod(self):
print("Men Money Machine & Matters")

def bMethod(self, param):
print("Hey I am testing class method :" + param)

def main():
c = ametClass()
c.aMethod()
c.bMethod('I am param porul')

main()

Result:

Men Money Machine & Matters

Hey I am testing class method :I am param porul

####inheritance

class aClass():

def aMethod(self):
print('A ha : Base class method 1')

def bMethod(self, str):
print('oh oh Base class method 2 '+str)

class childClass(aClass):

def cMethod(self):
aClass.aMethod(self) # Note instance of base class method
print('A ha : Child class Method1.....')

def dMethod(self, str):
print('Oh Oh Child class method 2'+str)

def main():

c1 = aClass()
c1.aMethod() # Note child inherited from aClass
c1.bMethod('Base class ..nna') # Note child inherited from aClass

c2 = childClass()
c2.aMethod()
c2.bMethod('Besh besh Child Class Method1')
c2.cMethod()
c2.dMethod('Nanna Irukku Child Class Method 2')

main()

Result

A ha : Base class method 1

oh oh Base class method 2 Base class ..nna

A ha : Base class method 1

oh oh Base class method 2 Besh besh  Child Class Method1

A ha : Base class method 1

A ha : Child class Method1.....

Oh Oh Child class method 2Nanna Irukku Child Class Method 2

Using Constructors
# Constructors : Defining and initalizing  values

class Cadet:

name = " " # Class Variables
def __init__(self, name):
self.name = name

def printWelcome(self):
print('Welcome to Kalvi Koil, AMET '+ self.name)

Cadet1 = Cadet('Anbu')

Cadet1.printWelcome()

Result :

Welcome to Kalvi Koil, AMET  Anbu

The above sample codes explain the how to define a class, define class method, inherit a class, overloading a method, initialize the class using constructor.

Happy Learning by simple super code!

Python#06

 Python Yield

yield is not like return. When return is used it is given to caller. When yield is used you can iterate, pass or suspend. Le us see with example. Ready guys! Start.. Here you go..

Here is the situation when you should use Yield instead of Return

Use yield instead of return when the data size is large

Yield is the best choice when you need your execution to be faster on large data sets.

Use yield when you want to return a big set of values to the calling function. 

Yield is an efficient way of producing data that is big or infinite.
yield wont take memory. 

Execution is faster The yield keyword in python works like a return with the only difference is that instead of returning a value, it gives back a generator function to the caller. 

A generator is a special type of iterator that, once used, will not be available again. 

The values are not stored in memory and are only available when called.

The values from the generator can be read using for-in, list() and next() method.

The main difference between yield and return is that yield returns back a generator function to the caller and return gives a single value to the caller.

Yield does not store any of the values in memory, and the advantage is that it is helpful when the data size is big, as none of the values are stored in memory.

The performance is better if the yield keyword is used in comparison to return for large data size.

# Yield is just like return but with generator(?) objects instead of values
Generators are special functions that have to be iterated to get the values
# To get the values the
# To get the values the objects has to be iterated
#Syntax yield expression
# #Sample yield function
# def demoyield():
# yield "Welcom to AMET - Pioneer in Maritime Education"
#
# out = demoyield()
# print(out)
# #<generator object demoyield at 0x000002802AC5DA50>
# # iterate to get the value in the above object
# #Generators are functions that return an iterable generator object. The values from the generator object are fetched one at a time instead of the full list together and hence to get the actual values you can use a for-loop, using next() or list() method
# for i in out:
#.      print(i)
# Example 2
# def gen():
#       yield 'G'
#.      yield 'A'
#       yield 'N'
#       yield 'D'
#       yield 'H'
#       yield 'I'
#       yield ' '
#       yield 'M'
#       yield 'A'
#       yield 'H'
#       yield 'A'
#       yield 'N'
#
# demo = gen()
#
# for i in demo:
#.      print(i)
#
#example 3 difference between normal function and generator function
#Normal
def normalfun():
     return 'Hello Zoox Robo Taxi to Universe - normal function'
def genfun():
       yield "'Hello Zoox Robo Taxi to Universe - generator function"

print(normalfun())
print(genfun())
# Hello Zoox Robo Taxi to Universe - normal function
#until it prints the whole string normalfun()wont stop
# <generator object genfun at 0x00000298E53AD900>
#but gen iterates so we can use the generator obhject to get the values and also , 'pause' and 'resume'
print(next(genfun()))
#Note next function
print(list(genfun()))

Python#05

 File Operations in Python

How to open a file, read, print, write, append the contents.?  All shown with the following example code and output

 # Simple Excel file read


import pandas as pd

csv_file = pd.read_csv('csv.csv')

print(csv_file)


# # printed the following
# h1 h2 h3 h4
# 0 1 2 3 4
# 1 5 6 7 8
# 2 9 10 11 12
# 3 13 14 15 16
# ##################
#Excel file sheet1 reading specific

excel_file = pd.read_excel('sample.xlsx', sheet_name='Sheet1')

print(excel_file)

# Print out
# Unnamed: 0 slno name age sal
# 0 1 1 1 1 1
# 1 2 2 2 2 2
# 2 3 3 3 3 3
# 3 4 4 4 4 4
# read multiple sheets

df_sheet_multi = pd.read_excel('sample.xlsx', sheet_name=['Sheet1', 'Sheet2'])

print(df_sheet_multi)

#Printout
# {'Sheet1': Unnamed: 0 slno name age sal
# 0 1 1 1 1 1
# 1 2 2 2 2 2
# 2 3 3 3 3 3
# 3 4 4 4 4 4, 'Sheet2': Unnamed: 0 slno name age sal
# 0 1 11 11 11 11
# 1 2 22 33 44 55
# 2 3 66 66 66 66
# 3 4 77 77 77 77}

print(25*'-','Sheet1')

print(df_sheet_multi['Sheet1'])


# ------------------------- Sheet1
# Unnamed: 0 slno name age sal
# 0 1 1 1 1 1
# 1 2 2 2 2 2
# 2 3 3 3 3 3
# 3 4 4 4 4 4

print(25*'-','Sheet2')

print(df_sheet_multi['Sheet2'])


# ------------------------- Sheet2
# Unnamed: 0 slno name age sal
# 0 1 11 11 11 11
# 1 2 22 33 44 55
# 2 3 66 66 66 66
# 3 4 77 77 77 77

# To Create and write contents

f = open("demo.txt", "w")

f.write("I have written the contents!")

f.close()



#open and read the file after the appending:
f = open("demo.txt", "r")

print(f.read())

#prints => I have written the contents!
f.close()


f = open("demo.txt", "a")

f.write("Now I have written the contents more again !")

f.close()

#In demo.txt => I have written the contents!Now I have written the contents more again !

import os.path

file_exists = os.path.exists('readme.txt')

print(file_exists)

#False

import os.path

file_exists = os.path.exists('demo.txt')

print(file_exists)

#True

f = open("demo1.txt", "w")

f.write("I have written the contents!")

f.close()


f = open("demo2.txt", "w")

f.write(str(list(csv_file)))


f = open("demo2.txt","r")

print(f.read())

#f.close()

print(f.read())

#Print ['h1', 'h2', 'h3', 'h4']


Hope The above simple code snippets and printouts shown as comments is clear and understandable. Happy Open and Distance Learning!

Work Diary - 2025

Date Link 28.01.2025 https://ametodl.blogspot.com/p/experience-with-deepseek-r1.html 02....