DevOps Classroom Notes 06-Oct-2025

Blocks in python

  • In python we will have block for
    • if
    • for
    • while
    • class
    • def
  • Block will have an indentation
block1 :
    a......
    b......
c...
block2:
    d......
    e......

Conditionals in python

n = 50
if n%2 == 0:
    print("even")
else:
    print("odd")
  • Grades
Marks Grade Grade Point
91–100 A1 10.0
81–90 A2 9.0
71–80 B1 8.0
61–70 B2 7.0
51–60 C1 6.0
41–50 C2 5.0
33–40 D 4.0
21–32 E1 Fail
0–20 E2 Fail
  • Solution
if 90 < marks <= 100:
    print("A1")
elif 80 < marks <= 90:
    print("A2")
elif 70 < marks <= 80:
    print("B1")
elif 60 < marks <= 70:
    print("B2")
elif 50 < marks <= 60:
    print("C1")
elif 40 < marks <= 50:
    print("C2")
elif 32 < marks <= 40:
    print("D")
elif 21 < marks <= 32:
    print("E1")
elif 0 <= marks <= 20:
    print("E2")
  • Tax Slab Rate
Taxable Income (₹) Tax Rate
Up to ₹ 4,00,000 0%
₹ 4,00,001 – ₹ 8,00,000 5%
₹ 8,00,001 – ₹ 12,00,000 10%
₹ 12,00,001 – ₹ 16,00,000 15%
₹ 16,00,001 – ₹ 20,00,000 20%
₹ 20,00,001 – ₹ 24,00,000 25%
Above ₹ 24,00,000 30%
  • Code
salary_in_lakhs = 76
if 0 <= salary_in_lakhs <= 4:
    print("0%")
elif 4 < salary_in_lakhs <= 8:
    print("5%")
elif 8 < salary_in_lakhs <= 12:
    print("10%")
elif 12 < salary_in_lakhs <= 16:
    print("15%")
elif 16 < salary_in_lakhs <= 20:
    print("20%")
elif 20 < salary_in_lakhs <= 24:
    print("25%")
elif salary_in_lakhs > 24 :
    print("30%")
else:
    print("invalid value")

Debugging in python

  • Create a new folder
  • open visual studio code in this
mkdir <somefolder>
cd <somefolder>
code .
  • Create a new file called main.py
  • Copy the code
# Number of terms to display
n_terms = 10

# First two terms
a, b = 0, 1

print("Fibonacci Series:")
for _ in range(n_terms):
    print(a, end=" ")
    a, b = b, a + b

  • Ensure you are able to debug by adding breakpoints.
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube