Instructions to the Python Virtual Machine to do something.
declarations,
assignments,
methods calls
input/output statements,
classes and objects
etc.
Single If
marks = 90
if marks > 80 :
print("lets party")
If-else block
marks = 90
if marks > 80 :
print("lets party")
else:
print("work hard next time")
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")
Do something again & again!
//Init
while condition is True:
//execute some stuff
//update
Find the sum of numbers from 1 to N
Example
N = 4
Output
10
Take input N, followed by N numbers find their sum.
Example
N = 4
Output
10
Given a Number, check if it is Prime or Not!
Input
11
Output
Yes
Given a Number, print the sum of its digits.
Input
11
Output
2
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