❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdaySuresh S

GIT - Basics

By: Suresh S
20 August 2024 at 20:48

GIT is a powerful version control system which used to manage the code across multiple users and track changes across different versions.

Installation:

Download and install GIT from the below path
https://git-scm.com/download/win

  • Once installed, Git can be used as a version control system through various commands.
  • You can configure Git for a specific folder on your computer, allowing you to manage all changes to existing files and the addition of new files within that folder

Basic commands:

1. git init:

This will initialize new repository in the current directory. This also creates .git directory and store all version control information.

2. git config:
git config --global user.name "Suresh"
git config --global user.mail "Suresh.Sundararaju@gmail.com"

3. git status
Shows the current status of working area like staged, untracked and unstaged.

4. git add
add changes from working directory to the staging area, preparing them to commit.

  • To add specific file: git add "filename.py"
  • To add all changes git add .

5. git commit

  • git commit -m "<message>"
  • Commits the staged changes with descriptive mesage

6. git log

  • Displays the list of commit history for the repository.
  • It will show commit id, author, dates and commit changes

Creating a branch

  • git branch <branch_name> - to create branch
  • git checkout <branch_name> - to switch to the new branch
  • git branch -b <branch_name> - to create and switch to branch
  • git branch - to view all the branches (current branch will be highlighted with asterisk)

Merge a branch:
Once completed work on a branch and want to integrate it into another branch (like master), merging comes to place.

  • It means all the changes we have made in <branch_name> will be merged with master branch.
  • First, switch to the branch you want to merge into: git checkout master
  • Then, use git merge <branch_name> to merge your branch.

Deleting branch
Once the code changes in <branch_name> merged into <master> branch, we might need to delete branch.

  • use git branch -d <branch_name> to delete branch

Python - Dictionary, Set, Tuple

By: Suresh S
12 August 2024 at 13:07

All three are different type of data structures in python. This is used to store different Collections of data. Based on the usecase of our requirement, we need to choose among these.

Comparision_dict_set_tuple

Dictionary (dict):

  1. Dictionary is collection of key value pair, where each key is associated with a value
  2. Data can be retrieved based on key value(Key based search) as the keys are required to be unique.
  3. Dictionaries are unordered till 3.7, values can be changed. Key name cannot be changed directly

Syntax:
inventory = {'apple':20, 'Banana':30 , 'carrot':15, 'milk':15}
print('\t1. Inventory items', inventory)

Dictionaries can be added with another value/modfied the value of existing key using the below syntax

inventory['egg'] = 20
inventory['bread'] = 25
print('\t2. Updated Inventory items', inventory)
inventory['egg']= inventory['egg']+5
print('\t3. After restocking', inventory)

  • removing the data from dict can be done using del keyword.
  • Checking the presence of data can be done using in keyword. Result will be boolean.

del inventory['carrot']
del inventory['bread']
print('\t4. Updated Inventory after delete', inventory)

is_bananas_in_inventory = 'Banana' in inventory
print('\t5a. Is banana in inventory', is_bananas_in_inventory)
is_oranges_in_inventory = 'Orange' in inventory
print('\t5b. Is Orange in inventory', is_oranges_in_inventory)

Notes:
Additionaly dict.items() will give each item in dictionary as tuple (like key value pair). by using list(dict.items()) we can also get the data as list. Using for loop and if condition, we can access particular key and do the desired operation for that data

for product, product_count in inventory.items():
    print('\t\t6. Product:', product, 'count is:', product_count)
print ('\t7. Iterating inventory gives tuple:', inventory.items())

#Printing only egg count(Value of key 'egg') by itearting dict
for product, product_count in inventory.items():
    if product is 'egg':
        print('\t8. Product:', product, ' its count is:', product_count)

#Printing egg count (value of key 'egg')
print('\t9. Count of apple',inventory['egg'])
Output:
        1. Inventory items {'apple': 20, 'Banana': 30, 'carrot': 15, 'milk': 15}
        2. Updated Inventory items {'apple': 20, 'Banana': 30, 'carrot': 15, 'milk': 15, 'egg': 20, 'bread': 25}
        3. After restocking {'apple': 30, 'Banana': 30, 'carrot': 15, 'milk': 15, 'egg': 25, 'bread': 25}
        4. Updated Inventory after delete {'apple': 30, 'Banana': 30, 'milk': 15, 'egg': 25}
        5a. Is banana in inventory True
        5b. Is Orange in inventory False
                6. Product: apple count is: 30
                6. Product: Banana count is: 30
                6. Product: milk count is: 15
                6. Product: egg count is: 25
        7. Iterating inventory gives tuple: dict_items([('apple', 30), ('Banana', 30), ('milk', 15), ('egg', 25)])
        8. Product: egg  its count is: 25
        9. Count of apple 25

Set:
A set is an unordered collection of unique elements. Sets are mutable, but they do not allow duplicate elements.

Syntax:
botanical_garden = {'rose', 'lotus', 'Lily'}
botanical_garden.add('Jasmine')
botanical_garden.remove('Rose')
is_present_Jasmine = 'Jasmine' in botanical_garden

Above we can see to define a set, adding a values and removing it. If we add same elements in a set, it will through an error.

Also we can compare two sets similar to venn diagram. Like Union, difference, intersection of two data sets.

botanical_garden = {'Tuple', 'rose', 'Lily', 'Jasmine', 'lotus'}
rose_garden = {'rose', 'lotus', 'Hybiscus'}

common_flower= botanical_garden.intersection(rose_garden)
flowers_only_in_bg = botanical_garden.difference(rose_garden)
flowers_in_both_set = botanical_garden.union(rose_garden)

Output will be a set by default. 
If needed we can typecase into list using list(expression)

Tuple:
A tuple is an ordered collection of elements that is immutable, meaning it cannot be changed after it is created.

Syntax:

ooty_trip = ('Ooty', '2024-1-1', 'Botanical_Garden')
munnar_trip = ('Munar', '2024-06-06', 'Eravikulam National Park')
germany_trip = ('Germany', '2025-1-1', 'Lueneburg')
print('\t1. Trip details', ooty_trip, germany_trip)

#Accessing tuple using index
location = ooty_trip[0]
date = ooty_trip[1]
place = ooty_trip[2]

print(f'\t2a. Location: {location} Date: {date} Place: {place} ')

location, date, place =germany_trip # Assinging a tuple to 3 different variables
print(f'\t2b. Location: {location} Date: {date} Place: {place} ')

print('\t3. The count of ooty_trip is ',ooty_trip.count)

Output:
   1. Trip details ('Ooty', '2024-1-1', 'Botanical_Garden') ('Germany', '2025-1-1', 'Lueneburg')
   2a. Location: Ooty Date: 2024-1-1 Place: Botanical_Garden
   2b. Location: Germany Date: 2025-1-1 Place: Lueneburg
   3. The count of ooty_trip is  <built-in method count of tuple object at 0x0000011634B3DBC0>

Tuples can be accessed using index. The values of tuples can be assigned to multiple variables easily. We can combine two tuples which will create another tuple. But tuple cannot be modified.

Python - files

By: Suresh S
12 August 2024 at 08:51

File operations:

  • File reading
  • File writing
  • appending the content

File Reading:
with open('Logs.txt', 'r') as file:

open is python built in function used to open file. First arguments refers the file name and second argument is mode of reading.
with statement is for automatic closing of file. This will prevent memory leaks, providing a better resource manageement
as file as keyword assigns the opened file object to variable file

with open('logs.txt', 'r')as file:
    # print(file, type(file))
    content = file.readlines()
    print(content, type(content))   # this content is a list. Elements are each line in file 
    for line in content:
        print(line, end='') # end='' is defined to avoid \n as list iteration ends already with \n
        #print(line.strip())

Output:
['This is the file used to store logs\n', 'Created on 12.08.2024\n', 'Author Suresh Sundararaju\n'] <class 'list'>
This is the file used to store logs
Created on 12.08.2024
Author Suresh Sundararaju

  • file.readlines() will give the file content as list
  • file.readline() will give the first line as string

  • Iterating the list, each line can be retrieved as string

  • Iterating the later, each str can be retrieved as character

Here when iterating the list via for loop, the return ends with newline. when printing with print statment, another new line comes. To avoid that strip() or end='' is used

File writing:
with open('notes.txt','w') as file:

This is similar to file reading. the only syntax difference is mode is given as 'w'. Here notes.txt file will be created.

Further to write the content, we can use file.write('Content')
In write mode, a file is created each time and the content within that block is overwritten

# Write in file
with open('notes.txt', 'w') as file:
    i=file.write('1. fILE CREATED\n')
    i=file.write('2. fILE updated\n')

Appending in file:
with open('notes.txt', 'a') as file:

For appending, mode='a' is to be used with file.write(str) or file.writelines(list). Here in the existing file, the content will be updated at the end.

#Append file
with open('notes.txt', 'a') as file:
    file.write('Content appended\n')


#Read all the lines and store in list
with open('notes.txt', 'r') as file:
    appendcontent = file.readlines()
    print(appendcontent)

Output:
['1. fILE CREATED\n', '2. fILE updated\n', 'Content appended\n']

Notes:

  1. There is some other modes available 'r+','w+','a+'
  2. exception can be added

Python - Lists and Tasks Solved!

By: Suresh S
1 August 2024 at 06:37

After learning indexing and slicing, we started learning more about Lists and in built methods. The methods are

Returns None

  • append
  • insert
  • remove
  • Sort
  • reverse
  • clear

Returns int

  • index
  • count

Returns str

  • pop

For smaller changes in delivery list, in built function itself is enough. But when we want to do more operations with the list, for loop, if loop will be needed.

For eg, there is a list ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop', 3] where only string needs to be converted to upper case. Here we cannot use list or string methods directly. The ideal logic would be

  1. we have to iterate the list one by one
  2. Check the item is string or other type
  3. Use string method upper() and append() accordingly

So here for loop, if,else condition is needed

delivery_list= ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop', 3]
upper_list = []
for item in delivery_list:
    if type(item) == str:
        upper_list.append(item.upper())
    else:
        upper_list.append(item)

print('Upper case list is:', upper_list)

Output:
Upper case list is: ['PENCIL', 'NOTEBOOK', 'MARKER', 'HIGHLIGHTER', 'GLUE STICK', 'ERASER', 'LAPTOP', 3]

Tasks given were to practice more about such methods and logics. those were interesting to find the logic or methods available.
Solved details are

Tasks_list.py
#######################################################################################
#1. Create a list of five delivery items and print the third item in the list. 
#eg: [β€œNotebook”, β€œPencil”, β€œEraser”, β€œRuler”, β€œMarker”]
#######################################################################################

delivery_list = ['Notebook', 'Pencil', 'Eraser', 'Ruler', 'Marker']
print (f'\t1. Third item in the list{delivery_list} is: {delivery_list[2]}')

#######################################################################################
# 2.A new delivery item β€œGlue Stick” needs to be added to the list. 
# Add it to the end of the list and print the updated list.
#######################################################################################

delivery_list.append('Glue Stick')
print('\t2. Updated delivery list is:', delivery_list)

#######################################################################################
# 3. Insert β€œHighlighter” between the second and third items and print the updated list.
#######################################################################################

delivery_list.insert(2, 'Highlighter')
print('\t3. Updated list by inserting Highlighter b/w 2nd &3rd:', delivery_list)

#######################################################################################
# 4. One delivery was canceled. Remove β€œRuler” from the list and print the updated list.
#######################################################################################
delivery_list.remove('Ruler')
print('\t4. Updated list after removing Ruler is:', delivery_list)

#######################################################################################
# 5. The delivery man needs to deliver only the first three items. 
# Print a sublist containing only these items.
#######################################################################################
sublist =[]
for item in delivery_list[:3]:
    #sublist =sublist.append(item)      #This is incorrect as sublist.append() returns None.
    sublist.append(item)

print('\t5. Sublist of first three elements using loop:', sublist) 
print('\t   Sublist of first three elements using slicing:', delivery_list[:3]) 


#######################################################################################
# 6.The delivery man has finished his deliveries. 
# Convert all item names to uppercase using a list comprehension and print the new list.
#######################################################################################

uppercase_list=[]
for item in delivery_list:
    uppercase_list.append(item.upper())
print('\t6. Uppercase list of delivery items:', uppercase_list)

uppercase_list_lc = [item.upper() for item in delivery_list]
print('\t6. Uppercase list using list compre:', uppercase_list_lc)



#######################################################################################
# 7. Check if β€œMarker” is still in the list and print a message indicating whether it is found.
# 8. Print the number of delivery items in the list.
#######################################################################################

is_found= delivery_list.count('Marker')
if 'Marker' in delivery_list:
    print(f'\t7. Marker is found {is_found} times')
else:
    print(f'\t7. Marker is not found {is_found}')

print(f'\t8. Number of delivery item from {delivery_list} is: ', len(delivery_list))

#######################################################################################
# 9. Sort the list of items in alphabetical order and print the sorted list
# 10. The delivery man decides to reverse the order of his deliveries. 
# Reverse the list and print it
#######################################################################################


delivery_list.sort()
print(f'\t9. Sorted delivery list is {delivery_list}')

delivery_list.reverse()
print(f'\t10. Reverse list of delivery list is {delivery_list}')

#######################################################################################
# 11. Create a list where each item is a list containing a delivery item and its delivery time. 
# Print the first item and its time.
#######################################################################################

delivery_list_time = [['Letter', '10:00'], ['Parcel', '10:15'], ['Magazine', '10:45'], ['Newspaper', '11:00']]
print('\t11. First delivery item and time', delivery_list_time[0])

delivery_list = ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop']
delivery_time = ['11:00','11:20','11:40','12:00','12:30','13:00', '13:30']

#Paring of two list using zip
paired_list=list(zip(delivery_list,delivery_time))
print('\tPaired list using zip:', paired_list[0:2])

#Combine corresponding item from multiple list using zip and for
item_time_list = [[item,time] for item, time in zip(delivery_list, delivery_time)]
print ('\tItem_time_list using list comprehension: ', item_time_list[0:1])


#######################################################################################
# 12. Count how many times β€œRuler” appears in the list and print the count.
# 13. Find the index of β€œPencil” in the list and print it.
# 14. Extend the list items with another list of new delivery items and print the updated list.
# 15. Clear the list of all delivery items and print the list.
# 16. Create a list with the item β€œNotebook” repeated three times and print the list.
# 17. Using a nested list comprehension, create a list of lists where each sublist contains an item 
# and its length, then print the new list.
# 18. Filter the list to include only items that contain the letter β€œe” and print the filtered list.
# 19. Remove duplicate items from the list and print the list of unique items.
#######################################################################################

is_found= delivery_list.count('Ruler')
print('\t12. The count of Ruler in delivery list is:', is_found)

index_pencil = delivery_list.index('Pencil')
print(f'\t13. Index of Pencil in {delivery_list} is {index_pencil}')

small_list = ['Ink','']
delivery_list.extend(small_list)
print('\t14. Extend list by extend:', delivery_list)

item_time_list.clear()
print('\t15. Clearing the list using clear():', item_time_list)

Notebook_list = ['Notebook']*3
print('\t16. Notebook list is:', Notebook_list)

#Filter the list with e letter
delivery_list

new_delivery_list = []
for item in delivery_list:
    if 'e' in item:
        new_delivery_list.append(item)

print ('\t18. Filtered list with items containing e:', new_delivery_list)

new_list_compre = [item for item in delivery_list if 'e' in item]
print ('\t18. Filtered list by list comprehension:', new_list_compre)

#Remove duplicate items
delivery_list.extend(['Ink', 'Marker'])
print('\t   ', delivery_list)

for item in delivery_list:
    if delivery_list.count(item) > 1:
        delivery_list.remove(item)

print('\t19. Duplicate remove list:',delivery_list)
print('\t19. Duplicate remove list:',list(set(delivery_list)))

#######################################################################################
# 17. Using a nested list comprehension, create a list of lists where each sublist contains an item 
# and its length, then print the new list.
#######################################################################################

#without list comprehension
nested_list = []
for item in delivery_list:
    nested_list.append([item, len(item)])

print('\t17. ', nested_list[-1:-6:-1])

#Using list comprehension printing nested list
nested_list = [[item,len(item)] for item in delivery_list]
print('\t17. Nested list with length:', nested_list[:5])

Answers:

PS C:\Projects\PythonSuresh> python Tasks_list.py
        1. Third item in the list['Notebook', 'Pencil', 'Eraser', 'Ruler', 'Marker'] is: Eraser
        2. Updated delivery list is: ['Notebook', 'Pencil', 'Eraser', 'Ruler', 'Marker', 'Glue Stick']
        3. Updated list by inserting Highlighter b/w 2nd &3rd: ['Notebook', 'Pencil', 'Highlighter', 'Eraser', 'Ruler', 'Marker', 'Glue Stick']
        4. Updated list after removing Ruler is: ['Notebook', 'Pencil', 'Highlighter', 'Eraser', 'Marker', 'Glue Stick']
        5. Sublist of first three elements using loop: ['Notebook', 'Pencil', 'Highlighter']
           Sublist of first three elements using slicing: ['Notebook', 'Pencil', 'Highlighter']
        6. Uppercase list of delivery items: ['NOTEBOOK', 'PENCIL', 'HIGHLIGHTER', 'ERASER', 'MARKER', 'GLUE STICK']
        6. Uppercase list using list compre: ['NOTEBOOK', 'PENCIL', 'HIGHLIGHTER', 'ERASER', 'MARKER', 'GLUE STICK']
        7. Marker is found 1 times
        8. Number of delivery item from ['Notebook', 'Pencil', 'Highlighter', 'Eraser', 'Marker', 'Glue Stick'] is:  6
        9. Sorted delivery list is ['Eraser', 'Glue Stick', 'Highlighter', 'Marker', 'Notebook', 'Pencil']
        10. Reverse list of delivery list is ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser']
        11. First delivery item and time ['Letter', '10:00']
        Paired list using zip: [('Pencil', '11:00'), ('Notebook', '11:20')]
        Item_time_list using list comprehension:  [['Pencil', '11:00']]
        12. The count of Ruler in delivery list is: 0
        13. Index of Pencil in ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop'] is 0
        14. Extend list by extend: ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop', 'Ink', '']
        15. Clearing the list using clear(): []
        16. Notebook list is: ['Notebook', 'Notebook', 'Notebook']
        18. Filtered list with items containing e: ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser']
        18. Filtered list by list comprehension: ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser']
            ['Pencil', 'Notebook', 'Marker', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop', 'Ink', '', 'Ink', 'Marker']
        19. Duplicate remove list: ['Pencil', 'Notebook', 'Highlighter', 'Glue Stick', 'Eraser', 'Laptop', '', 'Ink', 'Marker']
        19. Duplicate remove list: ['', 'Ink', 'Pencil', 'Notebook', 'Marker', 'Eraser', 'Laptop', 'Highlighter', 'Glue Stick']
        17.  [['Marker', 6], ['Ink', 3], ['', 0], ['Laptop', 6], ['Eraser', 6]]
        17. Nested list with length: [['Pencil', 6], ['Notebook', 8], ['Highlighter', 11], ['Glue Stick', 10], ['Eraser', 6]]

Indexing and Slicing

By: Suresh S
25 July 2024 at 14:55
  • Indexing and slicing is important concepts for me.
  • Possible application is LSB and MSB in digital electronics

Application:
I have a device which sets temperature based on the float value I set from driver or user interface. Internally float value converted into hex and device is asked to set the required temperature.

But When we want to read the complete details from device, it will be in hex format with multiple bytes. If I need only one byte of data in reverse order of its binary value, then slicing is best way to extract that value.

But I think Python is more efficient. When I learn more concepts, then some package related to hex to binary or dealing with hex datas would have some functions.

Learning:
I have tried and learnt the below items from this session

  • Positive indexing
  • Negative indexing
  • Slicing using positive indexing
  • slicing using negative indexing
  • Slicing in reverse order requires third argument Step
###############################################
#         INDEXING
###############################################

'''
Positive Indexing:
H E L L O   W O R L D
0 1 2 3 4 5 6 7 8 9 10
'''

#Positive indexing
message = 'HELLO WORLD'
print ('Postive indexing:', message[0], message [1], message [2], message [3], message [4])  # H E L L O

'''
Here indexing starts with 0. Python is able to strip the string like array elements
Negative indexing
H   E   L   L   O
-5  -4 -3  -2  -1
'''

#Negative indexing
message1 = '  Hello'
print ('Negative Indexing:', message1[-1], message1[-2], message1[-3], message1[-4], message1[-5]) # o l l e H

'''
Length is always number of characters or elements in string. 
  - length > last element index
  - length = last index +1

when we define out of range indexing, string index out of range error would come
In the above example,
'''

print('Length of string:',len(message), len(message1))     # 11 , 7


###############################################
#         SLICING
###############################################

#Message[Start:Stop:Step]
print('\nSlicing 1 to 4th index elements of HELLO WORLD using message[1:5]:', message[1:5])
print('Slicing before 6th index elements of HELLO WORLD using message[:6]:', message[:6])
print('Slicing from 6th index elements of HELLO WORLD using message[6:]:', message[6:])
print('Slicing from 6th index elements of HELLO WORLD using message[6: 100]:', message[6:100])


# Slicing using negative index also possible
print('\nSlicing using negative indexing in HELLO WORLD using message[-11:5]:', message[-11:5])
# Here number 5 is STOP, it refers 5th index
print('Slicing using negative indexing in HELLO WORLD using message[-11:-4]:', message[-11:-4])

'''
Reversing the message contents can be done using step definition
message [5:-10:-1]
'''
print('\nSlicing in reverse order using step (message [5:-12:-1]):',message [5:-12:-1])
print('Slicing in reverse order only ROW(NI) from HELLO WORLD (message [-3:-7:-1]):',message [-3:-7:-1])
print('Slicing in reverse order only ROW(PI) from HELLO WORLD (message [8:4:-1]):',message [8:4:-1])

Result:

PS C:\Projects\PythonSuresh> python Class7.py
Postive indexing: H E L L O
Negative Indexing: o l l e H
Length of string: 11 7

Slicing 1 to 4th index elements of HELLO WORLD using message[1:5]: ELLO
Slicing before 6th index elements of HELLO WORLD using message[:6]: HELLO 
Slicing from 6th index elements of HELLO WORLD using message[6:]: WORLD
Slicing from 6th index elements of HELLO WORLD using message[6: 100]: WORLD

Slicing using negative indexing in HELLO WORLD using message[-11:5]: HELLO
Slicing using negative indexing in HELLO WORLD using message[-11:-4]: HELLO W

Slicing in reverse order using step (message [5:-12:-1]):  OLLEH
Slicing in reverse order only ROW(NI) from HELLO WORLD (message [-3:-7:-1]): ROW
Slicing in reverse order only ROW(PI) from HELLO WORLD (message [8:4:-1]): ROW

Python Functions - Solved

By: Suresh S
18 July 2024 at 14:34

Task after functions class was checked. 7 tasks were given.. all the tasks are compelted.

Lessons learnt:

  • If comparison should always be with string with '' (if choice ==1 is incorrect but choice=='1' is correct.. choice is received as an input from user
  • print should not be assigned with any value
  • function definition must be on top not in below
  • Recursive function is not clear
  • Found a way to summarise multiple function task in single code.
  • Should not do IO like prints inside the function unnecessarily which is one of the good practice
  • Python has wonderful organization of code by itself with indent option
  • return type of function is dynamic. The operation inside the function determines the return type. eg, div, argument received may be int but final value will be float.

Tasks:

  1. Write a function greet that takes a name as an argument and prints a greeting message.
  2. Write a function sum_two that takes two numbers as arguments and returns their sum.
  3. Write a function is_even that takes a number as an argument and returns True if the number is even, and False if it is odd.
  4. Write a function find_max that takes two numbers as arguments and returns the larger one.
  5. Write a function multiplication_table that takes a number n and prints the multiplication table for n from 1 to 10.
  6. Write a function celsius_to_fahrenheit that takes a temperature in Celsius and returns the temperature in Fahrenheit.
  7. Write a function power that takes two arguments, a number and an exponent, and returns the number raised to the given exponent. The exponent should have a default value of 2.
import time

###########################################################################################################################
# 1. Write a function greet that takes a name as an argument and prints a greeting message
###########################################################################################################################
def greet(name):
    print(f"Hello {name}! Welcome to my python code. \nThank you for attending this Task party\n")

# greet('Suresh')
# greet(input("Welcome Guest: "))

###########################################################################################################################
# 2. Write a function sum_two that takes two numbers as arguments and returns their sum.
###########################################################################################################################
def sum_two(num1, num2):
    result = num1+num2
    print(f"Addition of {num1} and {num2} is: {result}\n")
    return result

# add = sum_two(3, 5)
# add=sum_two(int(input("Enter the num1 for addition: ")), int(input("Enter the num2 for addition: ")))

#############################################################################################################################
# 3. Write a function is_even that takes a number as an argument and returns True if the number is even, and False if it is odd.
#############################################################################################################################

def is_even(num):
    if num % 2 == 0:
        print (f"The number {num} is Even")
        return True

    else:
        print (f"The number {num} is Odd")
        return False

print(is_even (4))
print(is_even (int(input("Enter the number to find Odd/Even: "))))

# num = int(input("Enter the number to find Odd/Even: "))
# print = is_even(num)

###########################################################################################################################
#  4. Write a function find_max that takes two numbers as arguments and returns the larger one.
###########################################################################################################################

def find_max(num1, num2):
    if num1>num2:
        print (f"The number {num1} is bigger")
        return num1

    elif num1<num2:
        print (f"The number {num2} is bigger")
        return num2

    else:
        print(f"Both the numbers {num1} and {num2} are equal")

# result = find_max(int(input("Enter the num1 to find max: ")), int(input("Enter the num2 to find max: ")))
# print("\n")

###########################################################################################################################
#  5. Write a function multiplication_table that takes a number n and prints the multiplication table for n from 1 to 10.
###########################################################################################################################
def multiplication_table(n):
    for i in range(1,11):
        print(f"{i} x {n} = {i*n}")
        time.sleep(0.5)

# multiplication_table(int(input("Enter the multiplication table required: ")))
# print("\n")

###########################################################################################################################
# 6. Write a function celsius_to_fahrenheit that takes a temperature in Celsius and returns the temperature in Fahrenheit.
###########################################################################################################################
def celsius_to_fahrenheit(celsius):
    fahrenheit = (celsius * 9/5) + 32
    print(f"{celsius}Β°C is equal to {fahrenheit}Β°F")
    return fahrenheit


###########################################################################################################################
# 7. Write a function power that takes two arguments, a number and an exponent, and returns the number raised to the given exponent. 
# The exponent should have a default value of 2.
###########################################################################################################################
def power(base, exponent=2):
    result = base ** exponent
    print(f"The {base} raised to the power of {exponent} is {result}")
    return result


def tasks_function():
    # print("Tasks from function")
    print("Select Task")
    print("1. Function to greet and printing greeting message ")
    print("2. Function to sum two numbers")
    print("3. Function to find odd or even")
    print("4. Bigger number from two inputs")
    print("5. Multiplication table")
    print("6. celcius to Fahrenheit")
    print("7. Exponent of number ")

    # choice = input("Enter choice(1/2/3/4/5/6/7): ")

    total_times = 3
    while(total_times>0):
        total_times = total_times-1
        choice = input("Enter choice(1/2/3/4/5/6/7): ")

        if choice=='1':
            greet(input("Welcome Guest: "))

        elif choice=='2':
            add=sum_two(int(input("Enter the num1 for addition: ")), int(input("Enter the num2 for addition: ")))

        elif choice =='3':
            num = int(input("Enter the number to find Odd/Even: "))
            is_even(num)

        elif choice=='4':
            result = find_max(int(input("Enter the num1 to find max: ")), int(input("Enter the num2 to find max: ")))
            print("\n")

        elif choice=='5':
            multiplication_table(int(input("Enter the multiplication table required: ")))
            print("\n")

        elif choice=='6':
            celsius = int(input("Enter the temperature in Celsius: "))
            celsius_to_fahrenheit(celsius)

        elif choice=='7':
            base = int(input("Enter the base number: "))
            exponent_input = input("Enter the exponent (default is 2): ")
            if exponent_input:
                exponent=int(exponent_input)
            else:
                exponent=2
            # exponent = int(exponent_input) if exponent_input else 2
            power(base, exponent)

        else:
            print("Invalid Choice. Please enter a number between 1 and 7.")

tasks_function()

Health Insurance - HDFC Ergo

By: Suresh S
15 July 2024 at 10:41

HDFC Ergo: my:Optima Secure

  • Sum insured: 10lakh
  • Initial Quote: 66428
  • Premium revised : 77499

Exclusions:

  1. Preexisting diseases(PED) are not covered for 36 months
  2. Specified Disease/Procedure
  3. Claims within 30days for any illness except accident
  4. Investigation & Evaluation

Declared items:
Diabetes:

For Diabetes - Gemer P2 tablet.

Asthma

My mother was diagnosed with allergic reactions to dust(Wheezing problem) around 04.07.2022. I do not have any reports for that diagnosis. From that time, she has been taking these medicines regularly since then.

  • Okacet 10mg
  • TheoAsthalin tablets

Reference:

PED Declared and Accepted:
PED_Declared_Accepted

Questions from HDFC ergo:
Question_From_HDFC_Ergo

1. PED:

  • 36 months no coverage
  • Coverage after 36months is subject to accepted conditions
  • Under portablity norms, waiting period can be reduced
  • Sum insured extension apply, exclusion applied afresh

2. Specified Disease/Procedure

  • 24 months no coverage for the listed illness.
  1. Internal Congenital: Diseases of gall bladder, Pancreatitis, Catarack, Osteroarthritis and Osteoporosis
  2. Non Infective: Kidneystone and Urinary bladder stone, Ulcer and erosion of stomach, Reflux in Gastro Esophageal, Fissure/Fistula, Heamorrhoids
  3. Pilonidal sinus: Cysts, modules, polyps including breast lumps, PCOD, Sinusitis, Rhinitis, Skin tumors, Tonsililitis
  • 24 months no coverage for the listed surgical procedures
    1. Hernia, surgery for Vericose veins and vericose ulcers
    2. Joint relacement surgeries, polapsed Uterus, Glaucoma, Rectal prolapse, ENT surgery, Perianal abscesses.

3. 30 day waiting period
4. Investigation and Evaluation

Expenses primarily for diagnosis are excluded.
Rest cure, Rehab and respite care are exlused

  • Obesity related
  • Cosmetic and plastic surgery
  • adventure sports related
  • Breach of law with criminal intent
  • Excluded providers
  • Treatement for Alchoholism, drug
  • Unproved treatment
  • Surrogacy

For more details, please refer the below document:

Safety When working on or near Electrical installation

By: Suresh S
12 July 2024 at 10:28

Section1 - Welcome and Introduction

  • This course provides basic information to perform safely when working on or near electrical installations

  • This is based on German and European regulations and standards including DGUV regulation, DIN VDE 0105-100, EN 50110-1 and other relevant standards

Section2 - Legal Foundataions:

Here the standards and rules to be considered when working on or near electrical installations. Concepts of European standard and application in Germany will be discussed in simple terms.

Voltage levels:

  • 0-1000V AC
  • 0-1500V DC

Safely working is important and information about correct and safe approach must be provided to the workers. Hence this course is important. Also according to Accident prevention regulation DGUV, regulation1, Employers duty is to provide safety instructions to all individuals once a year. This will give a cap and can be appointed as electro technically instructed person. Main Objective is "to ensure maximum safety to all individuals".

The Regulations in Germany

  • How to act safely when working on or near electrical installations or equipment based on DGUV regulation 3 and DIN VDE 0105-100 is covered here. This is specific to Germany.
  • European standard for Operation of electrical installations EN50110 imposes less strict requirements

Technical Rules in Germany

  • There are techinical rules for workplaces and operational safety
  • Accident insurance agencies BG ETEM (for the electrical industry and electrical work) issue accident prevention regulation together with DGUV

The following rules are important.

  1. DGUV Regulation1 - Principles of prevention
  2. DGUV Regulation3 - Electrical installation and equipment
  3. DIN VDE 0105-100 "Operation of electrical installations" (This contains European minimum requirements + additional extensions

Other Rules:

  1. DIN VDE 0100 - Low voltage electrical installations
  2. DIN VDE 1000-10 . Reqs for persons working in a filed of electrical engineering.

The overall Regulations in Europe:
European Standard for Electrical safety regulation is published by CENELEC. EN50110-1 is "Operation of electrical installations

  • Part1: Minimum requirements for safety performing electrical work and applied to all CENELEC members
  • Part2: Set of annexes, one per each country.

EN50110 can be applied everywhere. Many countries outside Europe thinks this is enough as long as it is not work on liveparts or HV (>1000V AC/1500V DC)

Section 3 - The Dangers of Electricity

Biggest threats of electricity

  1. Electric Shock
  2. Injuries from instinctive reaction to an electrical shock
  3. Burns due to an explosion or an arc flash/arc blast

Electrical Shock:

Image description

The damage to the part depends on Duration and amount of energy running through it. Greater amount of energy & greater duration, greater the damage.

  • Effect * Duration = Energy
  • P(W) * h (hours) = E (kWh); 1kWh is 3.6megajoule (MJ)

Consequence of current through the body can be very low(harmless) to Very high(fatal) for an almost similar situations. The current through the circuit can be calculated using Ohms law.

  • U(v)=R(ohm)*I(A)
  • I = U/R

Voltage:
Here magnitude of voltage is crucial for the current. So higher the voltage, the greater and more dangerous the current becomes. In high voltages, even without touching the live parts, a circuit can be made via air through an arc flash.

Internal Impedance of Human body:
Once the person becomes part of electrical circuit, impedance of human body determines the consequence. The standard DIN IEC/TS 60 479-1 refers to the effect of electrical current on human beings. The value of body impedance depend on several factors

  1. The current path
  2. The touch voltage
  3. The duration of the current flow
  4. The frequency
  5. The degree of moisture of the Skin
  6. The surface area of contact
  7. The pressure exerted and temperature

Basic overview

  • In DC installation, circuit has a certain Resistance
  • In Ac installation, the correct term of resistance is Impedance

When talking of AC, the impedance(Z) is the product of Resistance(R), the inductive resitance(XL) and the capacitive resitance (Xc)

In Human bodies, body impedance may vary for person to person. At 400V AC 50/60 Hz, hand to hand current path, dry condition and large contact area, the average impedance is 950ohms. 5% of people it will be 700ohm or less. 5% of people it will be 1275ohms or more.

Image description

Path of the current:
Image description

Impact of touch voltage:
Image description

Humidity:
Moisture reduces the impedance incase of electrical contact. So wet hands leads to more impact of electrical current flow.

Image description

Area of contact:

  • Large contact surface of 10000 mm2 (10x10cm) - low impedance
  • Medium contact surface 1000 mm2 (3.1x3.1cm) - Medium impedance
  • Small contact surface 100 mm2 (1x1cm) - high impedance

If we use ohmmeter with probe, body impedance from hand to hand, the value will be between 100,000 to 2000 000 Ohms. This is due to Skins high impedance. It decreases quickly once a current flows through. Without Skin the impedance of the body is much lower. More info: DIN IEC TS 60479 -1.

Frequency

Image description

The Amount of Energy:
According to the standard DIN IEC TS 60479 -1,

The current and duration of current flow through the body is decisive for injuries. Current depends on voltage and Impedance of circuit. Time depends on whether the installation disconnects automatically.(Circuit breakers are slow in reaction but RCD interrupt the circuit at max 300ms)

The amount of energy is calculated

  • I2(Current) * Time = Energy

As the current is the indicator of electrical shock, the effects can be,

  1. Perecption threshold - < 0.5mA
  2. Reaction threshold - < 0.5mA
  3. Release threshold - < 5mA
  4. Ventricular fibrillation & unconsciousness thresholds - >30-40mA

Effects of Current on Human beings and livestock:
As per IEC,

  1. < 0.5mA can be tolerated for long time. Slight tingling can be felt
  2. 0.5mA to 200mA - Increase in BP, muscle spasms and involuntary muscle reactions
    • Upto 5mA can be tolerated for long time
    • 30 mA approximately 200ms
    • Upto 200mA duration less than 10ms
  3. 200mA to 500mA - Strong muscle reactions, difficulty in breathing, distruption of the heart rhythm. Furthermore as it is above release threshold, unable to let go off the power source due to lack of muscle control

  4. 500mA to 10000mA - life threatening area. Cardiac arrest/Ventricular fibrillation, hyperinflation of lungs, burns and other injuries

Image description

Secondary effects is injuries that occur after an electrical shock. For example Fell of a ladder after shock leads to Broken bones.
Aware of following

  1. Possible fall/an unstable platform
  2. Injuries due to sharp edges
  3. Loss of tools/equipment
  4. Head injuries

Short circuit:
European standard describes electrical arc flash as rare events. But when this occurs, the consequences are severe. This may occur because of loss of tools, malfunction of electrical devices and etc. So wear arc protection cloths and take protective measures against arcs.

Railway overhead lines in germany operated at 15kV. Safe distance is 3m.
Electrical accident example is shown of loosing multiple fingers. The person is an electrician and have performed the work several times. As he did not follow the rules, it leads to fatal damage. 1 or 1million in Germany. 1 of 1.1million in US

Section 4: Basic Principles of Electrical Safety

Levels of Responsibility:

  • The person responsible for electrical safety - Employer/Owner
    • Overall responsibility of safe operation
    • Establish the rules and organization framework
  • The nominated person in control of an electrical installation during work activities - Professional with high level of electrical knowledge.
    • Responsible for safe operation of electrical installation of work activities
    • Professionally qualified to access how work must be carried
    • Higher electrical qualification than the electrician.
  • The nominated person in control of the work activity - Foreman of work
    • Responsible for the safety of all individuals involved including people that are near to electrical installation
    • Tasked to oversee all activities
    • Ensure the operations are performed according to safety regulation.

Skill levels:

  • Low --> Ordinary person
  • Medium --> Instructed person (EuP)
  • High --> Skilled person (EFK)

Safe operation & Risk Assessment:

Safe Operation:
Basic rule is to ensure safe opertion. Therefore prior to work activity, risk assessment must take place

This evaluation must identify hazards if any and call for appropriate safety measures and precautions for safety of workers and equipment

Risk Assessment
Before work, all should agree on tasks to be done and necessary precautions. What may happen?

  • flow of current through the body
  • Short circuit with direct or indirect consequences

Risk Assessment process

Risk_Assessment_Process

Personnel:

  • Competence requirement:

Competence_requirements

  • Requirements for Personal Protective equipment
  • Instruction requirements
  • Habits and Behavior at work

Organization
Responsibility of electrical installation

  • Basically this is the owner
  • or CEO of company
  • when owner unable to provide risk assessment, person with sufficient qualification must be called in.

Delegation of responsibility
Two or more installation and/or Entrepreneurs
The access to Electrical hazardous areas

  • Access control
  • Sign board

Competence of skilled person

Communication
Communication can be passed orally or by written and using any communication devices in a clear and reliable manner

The work location
Site preparation

  • Adequate working space
  • Access
  • Lighting

Non electrical hazards - Precaution
Flammable materials - To be kept away

Tool, equipment and devices
Drawing, Records and Signs
Emergency arrangements

Annex_B7

Annex_B7_Detail

Review questions:

Image description

Image description

Image description

Section 5: Operational Procedures

(Operating Activities, Measurement, Testing and Inspection)

  • This section deals with the requirements of DIN VDE 0105-100 regarding the operation of electrical installations

  • This includes switching operations, functional Tests/Measurements, testing and inspection

General:
When working near or on electrical installation, you must use appropriate tools and equipment to protect against Hazards.

Before the work is started, it must be approved by

  • The person responsible for electrical installation or
  • The nominated person in control of the electrical installation during work activities

After the completion of work, it must be informed to

  • The person responsible for electrical installation or
  • The nominated person in control of the electrical installation during work activities.

Operating Activities
Operating activities are designed to change the electrical state of an electrical installation

This is divided into

  1. Daily use operations intended to modify electrical state without risks (Connect/Disconnect, Start/Stop)

    • Skilled or instruction person are allowed
  2. Safety operation intended to disconnect or reconnect the installation incase of work on or near electrical installation

    • Skilled(EFK) or instructed(EuP) person only allowed to do this

Functional checks, Measurement

  • Functional checks and measurment can be performed only by EuP or EFK
  • Ordinary persons are only allowed to carry out under the supervision of Skilled person(EFK)
  • Skilled person must learn what? How? Where? what to measure?
  • Slightest doubt, nominated person in conrl of the electrical installation during work activities must be contacted.

Safe Instrucments

Only approved, permitted tools must be used when working on electrical installation. Instruments should comply DIN EN61010-1 (VDE 0411-1).

Risk of accidents due to Measurments must be taken into consideration.
Internal resistance of a meter must be taken care.

Ensuring_Safety_measuring

  • Whenever there is a risk of direct contact with uninsulated live parts, PPE to protect against electric shock, short circuits or arcs must be used.
  • As long as the installation is classified as fully IP2X or better, wearing rubber gloves or appl insulating covers is not mandatory

Testing Qualifications

  • Testing includes to check the operation of electrial, mechanical or thermal condition of installation.
  • It also include measurment activities accordance with the regulations measurement. only EuP or EFK allowed to carry out this.

Dead State Testing:

Dead_State_Testing

Inspections

Inspections

It may include

  1. Visual examination
  2. Measuring and/or testing in accordance with the requirements of measurments and tests

This must be carried out with regard to the current electrical drawings and specifications.

Skilled person with experience in inspection are allowed to carry out. This is carried out to protect the personnel from hazards, considering the constraints imposed by the presence of bare live parts.

Results of inspection must be recorded as per national and local law. If necessary appropriate remedial action shall be taken.

Recurring inspection

  • Periodic inspection is required
  • It can be for random samples.
  • Scope and results of the periodic inspection of an installation shall be recorded in an inspection reports.

Review:

Quiz1

Quiz2

 Quiz3

Quiz4

Section 6 Working Procedures General Aspects

This section describes the general rules that must be observed in the specific work methods for dead working, live working and working in the vicinity of live parts.

This section is divided into three parts

  1. General Requirements
  2. Requirements incase of induced voltages
  3. Requirements in case of weather conditions

Safe operation Risk assessment:

SafeOperation_RiskAssessment

Responsibility and Authority:

Only the nominated person in control of the electrical installation during work activities is authorized to issue or withdraw a permit of the planned work

Responsi_Authority

Working Methods

There are three different working methods

  1. Dead working
  2. Live working
  3. Working in the vicinity of live parts

Regardless of methods above, protection against shock, short cicuit and arcing must be taken

WOrking_Methods

Working_Methods_Dead_Live

Specific requirements if risk of induction

Risk_Induction

Specific requirements incase of weather condition

Unfavorable environment conditions may cause limitations to the commencement of continuation of work. Example are

  • Lightning
  • Heavy rain
  • Thick fog
  • Strong winds

In case of weather related interruptions, nominated person in control of the electrical installation during work activities must be informed.

Insufficient visibility condition, no work should be started and all work activities in progress must be stopped after securing the work location.

Review:

Q1

Q2

Q3

Section 7: Dead working Procedure

Dead_Working_Procedure_1

In order to avoid electrical hazards, comply with Five safety rules. Prior to starting up work the following must be identified and understood

  • The workplace
  • the electrical system
  • the associated sources of danger and hazards.

The five safety rules:

Disconnect_Completely

Secure_Against_Reconnection

Verify_Absence_Voltage

Carry_Out_earthing_Short_Circuiting

Provide_Protection_against_liveparts

When the five safety rules are carried out by an instructed person, the person must be given the following instructions in detail

  • What must be disconnected?
  • How must the installations be secured against reconnection?
  • On which precise circuits and terminals must the absence of voltage be measured/Determined?
  • How and on which component must the earthing clamps be mounted?
  • Which live parts need to be covered, how should they be covered, and possible other actions to ensure protection against accidental contact?

Review

Qu1

Qu2

Qu3

Qu4

Section 8: Live Working

Here we cover live working: That is any work that is performed on liveparts or inside the live working zone of installation.

Definition:
All work in which a worker deliberately makes contact with live parts or reaches into the live working zone with either parts of his body or with tools, equipments or devices being handled

Introduction:

  • Low voltage - work is considered as live working when getting in direct contact with live parts
  • High voltage - All work in live working zone must be treated as live work, regardless of whether there is contact with liveparts or not.

  • Live working involves an increased risk of Short circuiting and electric shock. With proper safety rules adherence, work can be performed without incidents

  • Comparted to dead working zone, there is greater likelihood of an incident occuring when working live

  • Highest priority must therefore beto comply with all safety regulations.

  • Dead working or working in the vicinity of live parts is perferred working method.

The decision to work live cannot be made by the employee alone. Your company as well as your customer must be involved. Hopefully they will not want to take the risk associated with live working. The follwing risks are,

  1. Injuries to personnel
  2. Damages to equipment
  3. Electric arcs, explosions and
  4. Downtime nd rebuilding

Regulations:

  • Live working must be carried out in accordance with national regulations.
  • National regulations or additions apply prior to European standard DIN EN 501110. In Germany DIN VDE 0105-100:2015 as well as the DGUV regulations (German social accident insurance) apply before the Eurepean Standard.

Safety precautions

  • Check the national requirements first.
  • DIN EN 50110-2 National annexes contains snapshot of the regulations of the different countries at the time when the annexus were edited.
  • risk assessment must be peformed
  • All type of possible hazards must be identified and evaluated in relation to probability and severity Eg:
    1. THe voltage level
    2. The short circuit energy
    3. The insulation level of the installation
    4. The nature of the work and the work site

Voltage level

Voltage_Level

Voltage_Level1

Short circuit level

Short Circuit level

Low voltage installations:
Identifying and evaluating the electrical hazards of the electrical installation in essential prior to live work.

Resp: Person responsiblie for the EI during work activities.

Electrical installation can be divided into

  1. Extra low voltage
  2. Low voltage without dangerous short circut current.
  3. Low voltage with dangerous short circut current.

Extra low voltage installations:
When SELV installations, work can be carried out without protection against direct contact with live parts. However precautions must be taken to protect against short circuit.

Low voltage installations:()incl FELV & PELV
For installations protected against short cirucits, overload, the below requirements apply

  1. insulation of adjacent live parts
  2. Use of insulated tools
  3. Use of appropriate PPE

Low voltage with dangerous SC current:
Small short circuit (<2kA) may be dangerous. Neither DIN VDE 0105-100 nor DIN EN 50110-1 describe whe SC is dangerous. The requirement is

  1. THe risk of short cirucuit must be calculated according to DIN EN 61482, NFPA 70E or IEEE 1584

Decision process:

No1:
No1

No2:
No2

DP2

No3:

DP3

6.3.1:

631

631_1

6.3.2 Specific Training and Qualification

  • Special training must be setup. The training must include

    1. Theoretical exercise
    2. Practical exercise These exercise must be tailored to the work to be done after training.
  • Table 5 of DGUV regulation 3 has list of live work allowed

Table5_1

Table5_2

The person responsible for the installatin during work activities must confirm the level and ablity to perform live work with certificate of competence.

Certificate example:

Certificate

6.3.3 Maintaining personal skills for live working
The ability to carry out live work safely must be maintained
. An ongoing practical routine
. A new training
. A refersher training

The person responsible for the installation during work activities assess all certificates atleast anually.

DIN VDE 0105-100 recommends repeating the thery and practical instruction for every four years.

Also skill, health checks, qualification of employees must be checked.

6.3.4 Working methods

634

6.3.5 Working conditions

Working_Conditions

6.3.6 Tools, equipments and devices

636

6.3.7 Environmental conditions

Image description

6.3.8 Organization of work

638

Section 9: Working in the vicinity of live installations

Live working zone and the vicinity zone

Liveworking

The zones at low voltage:

LVZone

The zones at high voltage:

HVZone

Definition of working in the vicinity of live parts:

Def1

General aspects:

GeneralAspects

Preventing access to the work location:

PreventAccess

Section 10: Maintanance Procedures

General:
Main_General

Personnel:

  • Maintanance - Planned and approved by the nominated person in control of electrical installation during work activities

  • when doing maintanance on or near to electrical installation, the following points must be clearly defined

    • The relevant part of installation to be worked
    • The person responsible for maintenance often nominated person in control of work activity
  1. must be a skilled or instructed person

  2. must be qualified to perform the work

  3. appropriate tools and measurement equipment and PPE must be used

Repair work
It consists of following stages

  1. Fault localization
  2. Troubleshooting and/or replacement of parts
  3. Recommisioning of repaired part

Different working procedure for different stage might be required.

For troubleshooting - carried out based on dead working, live working, working in vicinity of live parts

Repairwork

Replacement of fuses:

Replacement_Fuses

ReFuses

Section 11: First Aid for Electrical Accidents

FirstAId

Electrical Accidents

Electric_Accidents

Python - First Week

By: Suresh S
11 July 2024 at 21:23

Python is taught online in Tamil without any cost. The only expectation from them is to create a blog and write our understanding after learning. Hence started writing the blog.

  • Started Learning python through Kaniyam. Got to know about two Tamil people Syed and Srini. Classes will be for Monday to Wednesday at 7pm to 8pm

  • WhatsApp group was created and 3 classes completed. Agenda for every class is clear. During the class Zoom Recording and YouTube Live both were made which is useful for Checking it again.

https://kaniyam.com/python-course-2024/
https://parottasalna.com/python-development/

I have already installed Python and VS code available in my laptop. Find little difficult to understand running the sample program via Terminal and from Vscode. After few tries it is little clear now. So environment is made available for the class.

Lot of free ebooks are available to learn python other than youtube videos. Recommended book links are as below

Day 1: Meet and Greet:

Agenda:

  1. Why Python ?
  2. Course Syllabus
  3. Python Installation - Windows, Linux
  4. Collab Notebook
  5. Where to see updates & recordings.
  6. Where to ask questions ?
  7. Our Expectations
  8. Basic Print Command
  9. About FOSS, FOSS Communities.

Post session, the below information is shared

Youtube Recording:
Part 1: https://www.youtube.com/live/rcJRkt3odlw?si=SZGCr6aBVwSQII0g
Part 2: https://www.youtube.com/live/xBpXOkyoFD8?si=Z89W5VAtLnkUpFHH

How to create a blog:
https://www.youtube.com/watch?v=pkp8WK9ub4o

Google Form to submit your blog url:
https://docs.google.com/forms/d/e/1FAIpQLSdiJ3qQ-37YSi2VnTFpgVIJL0iE9mxveKHA3kFnwVAmhJooMg/viewform?usp=sf_link

Whatsapp Group Links:
Group 1: https://chat.whatsapp.com/DcfvtLP0y6S0iUkjCJLcH7
Group 2: https://chat.whatsapp.com/ErBIxb1lQfs7mNRo33c4Vc
Group 3: https://chat.whatsapp.com/ETxQ9WVCXkp5TYmY22wLaC

Tamil Linux Forum Link: (Ask Your Queries here)
https://forums.tamillinuxcommunity.org/

Community Links
https://forums.tamillinuxcommunity.org/t/gather-all-the-foss-group-in-tamil-nadu/1387

Python Download Link:
https://www.python.org/downloads/
Google Colab Link:
https://colab.research.google.com/

Day 2: Python Print

Agenda:

  1. 10 min discussion on previous class
  2. Basic print statement
  3. Multiple prints
  4. separator
  5. concatenating strings
  6. escape sequences
  7. raw string
  8. printing quotes inside strings.
  9. printing numbers
  10. multiline strings
  11. string multiplication
  12. combining int and str in printing
  13. .format
  14. f-strings

Concepts are understood. Important links are

Youtube Recording:
Session: https://www.youtube.com/watch?v=zr3skBHzbAI&list=PLiutOxBS1Mizte0ehfMrRKHSIQcCImwHL&index=4&pp=gAQBiAQB
Q/A: https://www.youtube.com/watch?v=OWjW7GBMND4&list=PLiutOxBS1Mizte0ehfMrRKHSIQcCImwHL&index=5&pp=gAQBiAQB
Blog: https://parottasalna.com/2024/07/05/python-fundamentals-the-print/
Quiz: https://docs.google.com/forms/d/e/1FAIpQLSeW7dGCYrvPXBK7llexbwa_yImFQWFiHHE4c4ATOk-NwJWxIw/viewform?usp=sf_link
Task: https://parottasalna.com/2024/07/04/task-1-python-print-exercises/
Playlist: https://www.youtube.com/playlist?list=PLiutOxBS1Mizte0ehfMrRKHSIQcCImwHL
Colab Notebook: https://colab.research.google.com/drive/1Uu9btRd_U0i3-PRfZwlR2QalJRp0DbBK?usp=sharing
Infographics: https://parottasalna.com/wp-content/uploads/2024/07/print-method.pdf

Byte of Python book is recommended. The link is'''

https://python.swaroopch.com/
https://www.tutorialspoint.com/python/index.htm
https://python.swaroopch.com/
https://pymbook.readthedocs.io/

'''

Day 3: Data types Variables and constants
Agenda:

  1. Discussion on print quiz.
  2. Numeric Types (int, float, complex)
  3. Text Type (strings)
  4. Boolean Type (bool)
  5. None Type (None)
  6. How to check a data type ?
  7. What is a variable ?
  8. How to define it
  9. valid, invalid variables
  10. assigning values
  11. multiple assignment
  12. unpacking
  13. variable types
  14. Constants

Details shared
Print Quiz Solutions Video: https://youtu.be/JzFLSZySbRI
Print Task Solutions: https://youtu.be/k6pwbOZtQ30

Variables Datatypes & Constants:
Session: https://youtube.com/live/5G0PoJofxXk?feature=share
Q/A: https://youtube.com/live/9cJDqHwQG5k?feature=share
Blog: https://parottasalna.com/2024/07/07/python-fundamentals-constants-variables-and-data-types/
Quiz: https://docs.google.com/forms/d/e/1FAIpQLSezKyjHkKlg4Qo8juWqviZkasyWOcAcEcBzK_NsBwGYG3WAvg/viewform?usp=sf_link
Task: https://parottasalna.com/2024/07/07/task-2-constants-and-variables/
Playlist: https://www.youtube.com/playlist?list=PLiutOxBS1Mizte0ehfMrRKHSIQcCImwHL
Infographics: https://parottasalna.com/wp-content/uploads/2024/07/variables-constants-and-data-types-in-python.pdf

There was a Q&A session planned by Srini and Syed today as there are many participants(11.07.2024 - Thursday)

I told them that I will create a blog this weekend. Srini objected and said that postponing the activity will keep that delayed. Hence today I started writing my first blog.

For teaching Kids, below websites can be checked

Other important links:

I have asked two questions today.

  1. Website link to teach kids?
  2. To know in detail about print function(like hovering over VSCODE on print provides detail) what I have to do?
  3. For the above I have to add some addons. those are Python and Pylance
  4. During the conversation Pandas also came which is a library for Excel data processing.

Also there was some interesting questions came about AI training using Python. It seems like with the available data, next prediction will happen like Regression LinearGraph.To know more about AI, We need to study the Book from Kaniyam

AI Libraries

  • Scifikit
  • Tensorflow
  • pytorch

To do:

  1. Go through the link or search on adding python, Pylance library to VScode
  2. Explore Pandas with the Ebook
  3. Read Byte of python till date
❌
❌