❌

Reading view

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

Python_In_Tamil-002 - Statements

Dear All,
Good Morning.
As explained in Python_In_Tamil-001, type the below codes in the Editor Window of IDLE, save them, run them. You will get the output/results in your Shell Window.

For Python_In_Tamil-002, the topic is Python Statements.

Python statements are instructions or commands that perform actions, control program flow, or manipulate data.
 Assignment Statements:
age = 35
print(age)

name = "Govi"
print(name)
Assignment statements don’t produce results.

symbol is used to start writing a comment.

a = 5; b = -8
print(a + b)

 Print Statement:
print("Hello, World!")
len = 5; wid = 8
print(β€œArea of triangle: β€œ, (len * wid) / 2

 Multi-line statements:
line continuation character ().
addition = 10 + 20 + \
30 + 40 + \
50 + 60 + 70
print(addition)

 Implicit continuation:
addition = (10 + 20 +
30 + 40 +
50 + 60 + 70)
print(addition)

 list of strings:
names = ['Arun',
'Balaji',
'Ganesh']
print(names)

 dictionary name as a key and mark as a value:
students = {'Kadhir': 10,
'Kaavya': 11,
'Meena': 10}
print(students)

 Conditional Statements:
x = 6
if x > 10:
print("x is greater than 10")
elif x == 10:
print("x is equal to 10")
else:
print("x is less than 10")

 Loop Statements:
for i in range(6):
print(i)

x = 5
while x > 0:
print(x)
x -= 1

 Function Definition Statements:
def greet(name):
print("Hello, " + name)
greet(β€˜Govi’)

 Return Statement:
def add(a, b):
return a + b
result = add(4, 5)
print(result)

 Import Statements:
import math

 Exception Handling Statements:
try:
result = 10 / 0
except ZeroDivisionError:
print("Division by zero is not allowed.")

 Break and Continue Statements:
for i in range(10):
if i == 5:
break # Exit the loop when i is 5
print(i)

 pass Statement:
def placeholder_function():
pass

 del statement:
my_list = [1, 2, 3]
del my_list[1]

If you have any comments/suggestions, please write your reviews.
Let us meet tomorrow with Python_In_Tamil-003.

Thanks and Regards
Govi
https://www.youtube.com/@Python_In_Tamil

Python_In_Tamil-001

Dear All,
I am Govindarajan from Thanjavur. I teach Basic Python through OnLine. I am a PCEP and PCAP.
Ok, let us start learning Basic Python.

  1. Install python from python.org as per your computer system.

  2. In windows, in the search bar, type cmd, cmd page will get opened. Write python at the cursor location and press Enter. If you see Python with the version number of the python, then it is confirmed that python is installed in your system. If not, go to the point number 1 above.

  3. Then, in the search bar, type IDLE. Click on IDLE with right side mouse and click Run as administrator. you will see a new window titled as IDLE Shell python version number. This window is called as Shell window or Console window.

  4. In the shell window, click File => New File. Another window with a title as untitled will open. This window is called as Editor window. we will write all our codes/program in this Editor window. It will be saved as python file(.py extension).

  5. Type ('Hello World') with a file name as BP001, save it(Ctrl + s), click Run, click Run Module F5 (or Fn + F5), the code will get executed and you will see Hello World in your Shell Window.

  6. Great !!!. You have successfully completed your first program in Python. Congratulations.

Let us meet tomorrow in 'Python_In_Tamil-002'.

Thanks and Regards.
Govi.
https://www.youtube.com/@Python_In_Tamil

❌