SlideShare a Scribd company logo
Chapter 1 Basic Programming (Python Programming Lecture)
PYTHON
PROGRAMMING
Chapter 1
Basic Programming
Topic
• Operator
• Arithmetic Operation
• Assignment Operation
• Arithmetic Operation More Example
• More Built in Function Example
• More Math Module Example
Operator in Python
• Operators are special symbols in that carry out arithmetic or logical
computation.
• The value that the operator operates on is called the operand.
• Type of Operator in Python
• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Bitwise operators
• Identity operators
• Membership operators
PYTHON
PROGRAMMING
Chapter 1
Lecture 1.1.0
Basic Arithmetic Operator
Arithmetic Operator in Python
Operation Operator
Addition +
Subtraction -
Multiplication *
Division /
Floor Division //
Exponentiation **
Modulo %
Assignment Operator in Python
Operation Operator
Assign =
Add AND Assign +=
Subtract AND Assign -=
Multiply AND Assign *=
Divide AND Assign /=
Modulus AND Assign %=
Exponent AND Assign **=
Floor Division Assign //=
Note: Logical and Bitwise Operator can be used with assignment.
Summation of two number
a = 5
b = 4
sum = a + b
print(sum)
Summation of two number – User Input
a = int(input())
b = int(input())
sum = a + b
print(sum)
Difference of two number
a = int(input())
b = int(input())
diff = a - b
print(diff)
Product of two number
a = int(input())
b = int(input())
pro = a * b
print(pro)
Quotient of two number
a = int(input())
b = int(input())
quo = a / b
print(quo)
Reminder of two number
a = int(input())
b = int(input())
rem = a % b
print(rem)
Practice Problem 1.1
Input two Number form User and calculate the followings:
1. Summation of two number
2. Difference of two number
3. Product of two number
4. Quotient of two number
5. Reminder of two number
Any Question?
Like, Comment, Share
Subscribe
Chapter 1 Basic Programming (Python Programming Lecture)
PYTHON
PROGRAMMING
Chapter 1
Lecture 1.1.1
More Arithmetic Operator
Floor Division
a = int(input())
b = int(input())
floor_div = a // b
print(floor_div)
a = float(input())
b = float(input())
floor_div = a // b
print(floor_div)
a = 5
b = 2
quo = a/b
= 5/2
= 2.5
quo = floor(a/b)
= floor(5/2)
= floor(2.5)
= 2
Find Exponent (a^b). [1]
a = int(input())
b = int(input())
# Exponent with Arithmetic Operator
# Syntax: base ** exponent
exp = a ** b
print(exp)
Find Exponent (a^b). [2]
a = int(input())
b = int(input())
# Exponent with Built-in Function
# Syntax: pow(base, exponent)
exp = pow(a,b)
print(exp)
Find Exponent (a^b). [3]
a = int (input())
b = int(input())
# Return Modulo for Exponent with Built-in Function
# Syntax: pow(base, exponent, modulo)
exp = pow(a,b,2)
print(exp)
a = 2
b = 4
ans = (a^b)%6
= (2^4)%6
= 16%6
= 4
Find Exponent (a^b). [4]
a = int(input())
b = int(input())
# Using Math Module
import math
exp = math.pow(a,b)
print(exp)
Find absolute difference of two number. [1]
a = int(input())
b = int(input())
abs_dif = abs(a - b)
print(abs_dif)
a = 4
b = 2
ans1 = abs(a-b)
= abs(4-2)
= abs(2)
= 2
ans2 = abs(b-a)
= abs(2-4)
= abs(-2)
= 2
Find absolute difference of two number. [2]
import math
a = float(input())
b = float(input())
fabs_dif = math.fabs(a - b)
print(fabs_dif)
Built-in Function
• abs(x)
• pow(x,y[,z])
https://docs.python.org/3.7/library/functions.html
Practice Problem 1.2
Input two number from user and calculate the followings: (use
necessary date type)
1. Floor Division with Integer Number & Float Number
2. Find Exponential (a^b) using Exponent Operator, Built-in
pow function & Math Module pow function
3. Find Exponent with modulo (a^b%c)
4. Find absolute difference of two number using Built-in
abs function & Math Module fabs function
Any Question?
Like, Comment, Share
Subscribe
Chapter 1 Basic Programming (Python Programming Lecture)
PYTHON
PROGRAMMING
Chapter 1
Lecture 1.2
Arithmetic Operation Example
Average of three numbers.
a = float(input())
b = float(input())
c = float(input())
sum = a + b + c
avg = sum/3
print(avg)
Area of Triangle using Base and Height.
b = float(input())
h = float(input())
area = (1/2) * b * h
print(area)
Area of Triangle using Length of 3 sides.
import math
a = float(input())
b = float(input())
c = float(input())
s = (a+b+c) / 2
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
print(area)
𝑎𝑟𝑒𝑎 = 𝑠 ∗ (s−a)∗(s−b)∗(s−c)
𝑠 =
𝑎 + 𝑏 + 𝑐
2
Area of Circle using Radius.
import math
r = float(input())
pi = math.pi
area = pi * r**2
# area = pi * pow(r,2)
print(area)
𝑎𝑟𝑒𝑎 = 3.1416 ∗ 𝑟2
Convert Temperature Celsius to Fahrenheit.
celsius = float(input())
fahrenheit = (celsius*9)/5 + 32
print(fahrenheit)
𝐶
5
=
𝐹 − 32
9
𝐹 − 32 ∗ 5 = 𝐶 ∗ 9
𝐹 − 32 =
𝐶 ∗ 9
5
𝐹 =
𝐶 ∗ 9
5
+ 32
Convert Temperature Fahrenheit to Celsius.
fahrenheit = float(input())
celsius = (fahrenheit-32)/9 * 5
print(celsius)
𝐶
5
=
𝐹 − 32
9
𝐶 ∗ 9 = 𝐹 − 32 ∗ 5
𝐶 =
𝐹 − 32 ∗ 5
9
Convert Second to HH:MM:SS.
# 1 Hour = 3600 Seconds
# 1 Minute = 60 Seconds
totalSec = int(input())
hour = int(totalSec/3600)
min_sec = int(totalSec%3600)
minute = int(min_sec/60)
second = int(min_sec%60)
print("{}H {}M
{}S".format(hour,minute,second))
#print(f"{hour}H {minute}M {second}S")
# 1 Hour = 3600 Seconds
# 1 Minute = 60 Seconds
totalSec = int(input())
hour = totalSec//3600
min_sec = totalSec%3600
minute = min_sec//60
second = min_sec%60
print("{}H {}M
{}S".format(hour,minute,second))
#print(f"{hour}H {minute}M {second}S")
Math Module
• math.pow(x, y)
• math.sqrt(x)
• math.pi
https://docs.python.org/3.7/library/math.html
Practice Problem 1.3
1. Average of three numbers.
2. Area of Triangle using Base and Height.
3. Area of Triangle using Length of 3 sides.
4. Area of Circle using Radius.
5. Convert Temperature Celsius to Fahrenheit.
6. Convert Temperature Fahrenheit to Celsius.
7. Convert Second to HH:MM:SS.
Any Question?
Like, Comment, Share
Subscribe
Chapter 1 Basic Programming (Python Programming Lecture)
PYTHON
PROGRAMMING
Chapter 1
Lecture 1.2
More Operator
Comparison Operator in Python
Operation Operator
Equality ==
Not Equal !=
Greater Than >
Less Than <
Greater or Equal >=
Less or Equal <=
Logical Operator in Python
Operation Operator
Logical And and
Logical Or or
Logical Not not
Bitwise Operator in Python
Operation Operator
Bitwise And &
Bitwise Or |
Bitwise Xor ^
Left Shift <<
Right Shift >>
Other Operator in Python
• Membership Operator (in, not in)
• Identity Operator (is, not is)
Any Question?
Like, Comment, Share
Subscribe
Chapter 1 Basic Programming (Python Programming Lecture)

More Related Content

PDF
Basic Computer Troubleshooting
Meredith Martin
 
PDF
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
PDF
Chapter 2 Decision Making (Python Programming Lecture)
IoT Code Lab
 
PPTX
Logical operators
Daffodil International University
 
PPTX
2.2 turtle graphics
allenbailey
 
PPTX
Type casting in c programming
Rumman Ansari
 
PPTX
Introduction to Pseudocode
Damian T. Gordon
 
Basic Computer Troubleshooting
Meredith Martin
 
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
Chapter 2 Decision Making (Python Programming Lecture)
IoT Code Lab
 
2.2 turtle graphics
allenbailey
 
Type casting in c programming
Rumman Ansari
 
Introduction to Pseudocode
Damian T. Gordon
 

What's hot (20)

PPT
Infix prefix postfix
Self-Employed
 
PPTX
What is c
Nitesh Saitwal
 
PPTX
control statements in python.pptx
Anshu Varma
 
PPTX
Data structures
Sneha Chopra
 
PPTX
Python-List.pptx
AnitaDevi158873
 
PPTX
Chapter 08 data file handling
Praveen M Jigajinni
 
PDF
Computer Networking Lab File
Nitin Bhasin
 
PPT
Chapter 1: Introduction to Data Communication and Networks
Shafaan Khaliq Bhatti
 
PPTX
Python PRACTICAL NO 6 for your Assignment.pptx
NeyXmarXd
 
PPTX
Operator Overloading In Python
Simplilearn
 
PPTX
IP Configuration
Stephen Raj
 
PPTX
Internet protocols Report Slides
Bassam Kanber
 
PPTX
Variables in python
Jaya Kumari
 
PPTX
Functions in python slide share
Devashish Kumar
 
PPTX
Python Programming Essentials - M24 - math module
P3 InfoTech Solutions Pvt. Ltd.
 
PDF
Python Basic Operators
Soba Arjun
 
DOC
Computer network lesson plan
sangusajjan
 
PPT
Linear Search & Binary Search
Reem Alattas
 
PPTX
My lectures circular queue
Senthil Kumar
 
Infix prefix postfix
Self-Employed
 
What is c
Nitesh Saitwal
 
control statements in python.pptx
Anshu Varma
 
Data structures
Sneha Chopra
 
Python-List.pptx
AnitaDevi158873
 
Chapter 08 data file handling
Praveen M Jigajinni
 
Computer Networking Lab File
Nitin Bhasin
 
Chapter 1: Introduction to Data Communication and Networks
Shafaan Khaliq Bhatti
 
Python PRACTICAL NO 6 for your Assignment.pptx
NeyXmarXd
 
Operator Overloading In Python
Simplilearn
 
IP Configuration
Stephen Raj
 
Internet protocols Report Slides
Bassam Kanber
 
Variables in python
Jaya Kumari
 
Functions in python slide share
Devashish Kumar
 
Python Programming Essentials - M24 - math module
P3 InfoTech Solutions Pvt. Ltd.
 
Python Basic Operators
Soba Arjun
 
Computer network lesson plan
sangusajjan
 
Linear Search & Binary Search
Reem Alattas
 
My lectures circular queue
Senthil Kumar
 
Ad

Similar to Chapter 1 Basic Programming (Python Programming Lecture) (20)

PDF
Lecture 1 python arithmetic (ewurc)
Al-Mamun Riyadh (Mun)
 
PPTX
Strings in python are surrounded by eith
Orin18
 
PPTX
Lecture 5 – Computing with Numbers (Math Lib).pptx
jovannyflex
 
PPTX
Lecture 5 – Computing with Numbers (Math Lib).pptx
jovannyflex
 
PPTX
OPERATORS-PYTHON.pptx ALL OPERATORS ARITHMATIC AND LOGICAL
NagarathnaRajur2
 
PDF
Some hours of python
Things Lab
 
PDF
Python From Scratch (1).pdf
NeerajChauhan697157
 
PDF
Python : basic operators
S.M. Salaquzzaman
 
DOCX
Python Laboratory Programming Manual.docx
ShylajaS14
 
PDF
introduction to python programming course 2
FarhadMohammadRezaHa
 
PDF
python lab programs.pdf
CBJWorld
 
PDF
Class 2: Welcome part 2
Marc Gouw
 
PPTX
PYTHON
RidaZaman1
 
PPTX
2. data types, variables and operators
PhD Research Scholar
 
PDF
(2 - 1) CSE1021 - Module 2 Worksheet.pdf
ayushagar5185
 
PPTX
Python.pptx
AKANSHAMITTAL2K21AFI
 
PPTX
PPt Revision of the basics of python1.pptx
tcsonline1222
 
PPT
02sjjknbjijnuijkjnkggjknbhhbjkjhnilide.ppt
KhanhPhan575445
 
PDF
cel shading as PDF and Python description
MarcosLuis32
 
Lecture 1 python arithmetic (ewurc)
Al-Mamun Riyadh (Mun)
 
Strings in python are surrounded by eith
Orin18
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
jovannyflex
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
jovannyflex
 
OPERATORS-PYTHON.pptx ALL OPERATORS ARITHMATIC AND LOGICAL
NagarathnaRajur2
 
Some hours of python
Things Lab
 
Python From Scratch (1).pdf
NeerajChauhan697157
 
Python : basic operators
S.M. Salaquzzaman
 
Python Laboratory Programming Manual.docx
ShylajaS14
 
introduction to python programming course 2
FarhadMohammadRezaHa
 
python lab programs.pdf
CBJWorld
 
Class 2: Welcome part 2
Marc Gouw
 
PYTHON
RidaZaman1
 
2. data types, variables and operators
PhD Research Scholar
 
(2 - 1) CSE1021 - Module 2 Worksheet.pdf
ayushagar5185
 
PPt Revision of the basics of python1.pptx
tcsonline1222
 
02sjjknbjijnuijkjnkggjknbhhbjkjhnilide.ppt
KhanhPhan575445
 
cel shading as PDF and Python description
MarcosLuis32
 
Ad

More from IoT Code Lab (8)

PDF
7.1 html lec 7
IoT Code Lab
 
PDF
6.1 html lec 6
IoT Code Lab
 
PDF
5.1 html lec 5
IoT Code Lab
 
PDF
4.1 html lec 4
IoT Code Lab
 
PDF
3.1 html lec 3
IoT Code Lab
 
PDF
2.1 html lec 2
IoT Code Lab
 
PDF
1.1 html lec 1
IoT Code Lab
 
PDF
1.0 intro
IoT Code Lab
 
7.1 html lec 7
IoT Code Lab
 
6.1 html lec 6
IoT Code Lab
 
5.1 html lec 5
IoT Code Lab
 
4.1 html lec 4
IoT Code Lab
 
3.1 html lec 3
IoT Code Lab
 
2.1 html lec 2
IoT Code Lab
 
1.1 html lec 1
IoT Code Lab
 
1.0 intro
IoT Code Lab
 

Recently uploaded (20)

PPTX
Congenital Hypothyroidism pptx
AneetaSharma15
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PDF
Exploring-Forces 5.pdf/8th science curiosity/by sandeep swamy notes/ppt
Sandeep Swamy
 
PPTX
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
BANDITA PATRA
 
PDF
Wings of Fire Book by Dr. A.P.J Abdul Kalam Full PDF
hetalvaishnav93
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PDF
Landforms and landscapes data surprise preview
jpinnuck
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Congenital Hypothyroidism pptx
AneetaSharma15
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Exploring-Forces 5.pdf/8th science curiosity/by sandeep swamy notes/ppt
Sandeep Swamy
 
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 
UPPER GASTRO INTESTINAL DISORDER.docx
BANDITA PATRA
 
Wings of Fire Book by Dr. A.P.J Abdul Kalam Full PDF
hetalvaishnav93
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Landforms and landscapes data surprise preview
jpinnuck
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 

Chapter 1 Basic Programming (Python Programming Lecture)

  • 3. Topic • Operator • Arithmetic Operation • Assignment Operation • Arithmetic Operation More Example • More Built in Function Example • More Math Module Example
  • 4. Operator in Python • Operators are special symbols in that carry out arithmetic or logical computation. • The value that the operator operates on is called the operand. • Type of Operator in Python • Arithmetic operators • Assignment operators • Comparison operators • Logical operators • Bitwise operators • Identity operators • Membership operators
  • 6. Arithmetic Operator in Python Operation Operator Addition + Subtraction - Multiplication * Division / Floor Division // Exponentiation ** Modulo %
  • 7. Assignment Operator in Python Operation Operator Assign = Add AND Assign += Subtract AND Assign -= Multiply AND Assign *= Divide AND Assign /= Modulus AND Assign %= Exponent AND Assign **= Floor Division Assign //= Note: Logical and Bitwise Operator can be used with assignment.
  • 8. Summation of two number a = 5 b = 4 sum = a + b print(sum)
  • 9. Summation of two number – User Input a = int(input()) b = int(input()) sum = a + b print(sum)
  • 10. Difference of two number a = int(input()) b = int(input()) diff = a - b print(diff)
  • 11. Product of two number a = int(input()) b = int(input()) pro = a * b print(pro)
  • 12. Quotient of two number a = int(input()) b = int(input()) quo = a / b print(quo)
  • 13. Reminder of two number a = int(input()) b = int(input()) rem = a % b print(rem)
  • 14. Practice Problem 1.1 Input two Number form User and calculate the followings: 1. Summation of two number 2. Difference of two number 3. Product of two number 4. Quotient of two number 5. Reminder of two number
  • 15. Any Question? Like, Comment, Share Subscribe
  • 18. Floor Division a = int(input()) b = int(input()) floor_div = a // b print(floor_div) a = float(input()) b = float(input()) floor_div = a // b print(floor_div) a = 5 b = 2 quo = a/b = 5/2 = 2.5 quo = floor(a/b) = floor(5/2) = floor(2.5) = 2
  • 19. Find Exponent (a^b). [1] a = int(input()) b = int(input()) # Exponent with Arithmetic Operator # Syntax: base ** exponent exp = a ** b print(exp)
  • 20. Find Exponent (a^b). [2] a = int(input()) b = int(input()) # Exponent with Built-in Function # Syntax: pow(base, exponent) exp = pow(a,b) print(exp)
  • 21. Find Exponent (a^b). [3] a = int (input()) b = int(input()) # Return Modulo for Exponent with Built-in Function # Syntax: pow(base, exponent, modulo) exp = pow(a,b,2) print(exp) a = 2 b = 4 ans = (a^b)%6 = (2^4)%6 = 16%6 = 4
  • 22. Find Exponent (a^b). [4] a = int(input()) b = int(input()) # Using Math Module import math exp = math.pow(a,b) print(exp)
  • 23. Find absolute difference of two number. [1] a = int(input()) b = int(input()) abs_dif = abs(a - b) print(abs_dif) a = 4 b = 2 ans1 = abs(a-b) = abs(4-2) = abs(2) = 2 ans2 = abs(b-a) = abs(2-4) = abs(-2) = 2
  • 24. Find absolute difference of two number. [2] import math a = float(input()) b = float(input()) fabs_dif = math.fabs(a - b) print(fabs_dif)
  • 25. Built-in Function • abs(x) • pow(x,y[,z]) https://docs.python.org/3.7/library/functions.html
  • 26. Practice Problem 1.2 Input two number from user and calculate the followings: (use necessary date type) 1. Floor Division with Integer Number & Float Number 2. Find Exponential (a^b) using Exponent Operator, Built-in pow function & Math Module pow function 3. Find Exponent with modulo (a^b%c) 4. Find absolute difference of two number using Built-in abs function & Math Module fabs function
  • 27. Any Question? Like, Comment, Share Subscribe
  • 30. Average of three numbers. a = float(input()) b = float(input()) c = float(input()) sum = a + b + c avg = sum/3 print(avg)
  • 31. Area of Triangle using Base and Height. b = float(input()) h = float(input()) area = (1/2) * b * h print(area)
  • 32. Area of Triangle using Length of 3 sides. import math a = float(input()) b = float(input()) c = float(input()) s = (a+b+c) / 2 area = math.sqrt(s*(s-a)*(s-b)*(s-c)) print(area) 𝑎𝑟𝑒𝑎 = 𝑠 ∗ (s−a)∗(s−b)∗(s−c) 𝑠 = 𝑎 + 𝑏 + 𝑐 2
  • 33. Area of Circle using Radius. import math r = float(input()) pi = math.pi area = pi * r**2 # area = pi * pow(r,2) print(area) 𝑎𝑟𝑒𝑎 = 3.1416 ∗ 𝑟2
  • 34. Convert Temperature Celsius to Fahrenheit. celsius = float(input()) fahrenheit = (celsius*9)/5 + 32 print(fahrenheit) 𝐶 5 = 𝐹 − 32 9 𝐹 − 32 ∗ 5 = 𝐶 ∗ 9 𝐹 − 32 = 𝐶 ∗ 9 5 𝐹 = 𝐶 ∗ 9 5 + 32
  • 35. Convert Temperature Fahrenheit to Celsius. fahrenheit = float(input()) celsius = (fahrenheit-32)/9 * 5 print(celsius) 𝐶 5 = 𝐹 − 32 9 𝐶 ∗ 9 = 𝐹 − 32 ∗ 5 𝐶 = 𝐹 − 32 ∗ 5 9
  • 36. Convert Second to HH:MM:SS. # 1 Hour = 3600 Seconds # 1 Minute = 60 Seconds totalSec = int(input()) hour = int(totalSec/3600) min_sec = int(totalSec%3600) minute = int(min_sec/60) second = int(min_sec%60) print("{}H {}M {}S".format(hour,minute,second)) #print(f"{hour}H {minute}M {second}S") # 1 Hour = 3600 Seconds # 1 Minute = 60 Seconds totalSec = int(input()) hour = totalSec//3600 min_sec = totalSec%3600 minute = min_sec//60 second = min_sec%60 print("{}H {}M {}S".format(hour,minute,second)) #print(f"{hour}H {minute}M {second}S")
  • 37. Math Module • math.pow(x, y) • math.sqrt(x) • math.pi https://docs.python.org/3.7/library/math.html
  • 38. Practice Problem 1.3 1. Average of three numbers. 2. Area of Triangle using Base and Height. 3. Area of Triangle using Length of 3 sides. 4. Area of Circle using Radius. 5. Convert Temperature Celsius to Fahrenheit. 6. Convert Temperature Fahrenheit to Celsius. 7. Convert Second to HH:MM:SS.
  • 39. Any Question? Like, Comment, Share Subscribe
  • 42. Comparison Operator in Python Operation Operator Equality == Not Equal != Greater Than > Less Than < Greater or Equal >= Less or Equal <=
  • 43. Logical Operator in Python Operation Operator Logical And and Logical Or or Logical Not not
  • 44. Bitwise Operator in Python Operation Operator Bitwise And & Bitwise Or | Bitwise Xor ^ Left Shift << Right Shift >>
  • 45. Other Operator in Python • Membership Operator (in, not in) • Identity Operator (is, not is)
  • 46. Any Question? Like, Comment, Share Subscribe