Gen-AI Developer Classroom notes 16/Sep/2025

Python contd

Variables

# Variable
a = 5
# type hinting
a:int = 5

b = 5.0
# type hinting
b:float = 5.0

c = "hello"
# type hinting
c:str = "hello"

Operators

Python indentation

  • Block: Block in python refers to one or more lines of code
  • Refer Here for indentation

conditionals

  • Conditionally execute blocks of code
  • if
if <condition>:
    ....
    ....
  • if else
if <condition>:
    ....
    ....
else:
    ...
    ...
  • if else if
if <condition>:
    ....
    ....
elif <condition>:
    ....
    ....
elif <condition>:
    ....
    ....
elif <condition>:
    ....
    ....
else:
    ...
    ...

loops

  • Execute block of code in a loop (multiple times)
  • while
while <condition>:
   .....
   .....
   .....
  • Example
index:int = 1
max:int = 5
while index <= max:
    print(index)
    #index = index + 1
    index += 1
  • Refer Here for the notebook

  • Create an account in hackerrank as a developer and choose python

By continuous learner

enthusiastic technology learner

Leave a comment