Programming
Fundamentals
using Python🐍
Lecture
- statements
- branching
- looping
- coding problems

Statements
Instructions to the Python Virtual Machine to do something.
declarations,
assignments,
methods calls
input/output statements,
classes and objects
etc.
Conditional Statements
Single If
marks = 90
if marks > 80 :
print("lets party")

Conditional Statements
If-else block
marks = 90
if marks > 80 :
print("lets party")
else:
print("work hard next time")

Conditional Statements
If-else-if-else block
marks = 90
if marks > 80 :
print("lets party")
elif marks > 70:
print("great job")
else:
print("work hard next time")

Mutiple if blocks?
In line if-else block?
Loops
Do something again & again!

While Loop

//Init
while condition is True:
//execute some stuff
//update
While Loop Example
For Loop

Code Demo!
Number Sum

Find the sum of numbers from 1 to N
Example
N = 4
Output
10
Number Sum-II

Take input N, followed by N numbers find their sum.
Example
N = 4
Output
10
Prime Number

Given a Number, check if it is Prime or Not!
Input
11
Output
Yes
Sum the Digits

Given a Number, print the sum of its digits.
Input
11
Output
2
Time To Try!



8 Mins
Challenge 🔥
Stair Pattern
*
***
*****
Challenge 🔥
Triangle Pattern
*
***
*****
Challenge 🔥
Sum the digits of a given number.
Challenge 🔥
Sum the digits of a given number.
Code Repository
[Python 04] Programming fundamentals
By Prateek Narang
[Python 04] Programming fundamentals
- 10