Skip to content

Instantly share code, notes, and snippets.

View ParnikaTutorials's full-sized avatar

ParnikaTutorials

View GitHub Profile
@ParnikaTutorials
ParnikaTutorials / forLoop.py
Created June 24, 2022 14:02
For Loop Introduction
list1 = [1, 2, 3, 8, 4, 2, 5, 4, 6]
# variable to store the sum
sum = 0
# iterate over the list
for val in list1:
sum = sum+val
print("The sum is", sum)
@ParnikaTutorials
ParnikaTutorials / even_odd.py
Created June 24, 2022 13:53
TO VERIFY GIVEN NUMBER IS EVEN OR ODD
num = int(input("Enter a number: "))
if (num % 2) == 0:
print(num,"is a even number")
else:
print(num,"is a odd number")