Coding Exercise for Beginners in Python |Exercise 16 | Python Tutorials for Beginners #lec47

preview_player
Показать описание
In this Lecture we have written a Program in Python to calculate sum of even numbers from 1 to 100 using for loop and range function

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #pythonforbeginners #python #jennyslectures #pythonprogramming #codingquestions
Рекомендации по теме
Комментарии
Автор

Hello maam, we need to add 1 as per the question.then it will come 2551 if im not wrong.I did like this -
num = 1
for i in (2, 101, 2)
num+=i
print(f"The sum of even nos. from 1 to 100 including the extreme points is {num}.")
pliz correct me if im wrong.

mayanglambamlucky
Автор

I'm from tamilnadu... great fan of your work💖

AjayKumar-ztde
Автор

a=0
for i in range(0, 101, 2):
a=a+i
print(a)

acchuanjan
Автор

Ma'am, instead of using if function, can't we write range(0, 101, 2)?

sushruthanayak
Автор

s=int(input("Enter the max number to get sum from 0 to : "))
count=0
for i in range(0, s, 1):
if i%2==0:
count += i
print(count)

aswin.s
Автор

for storing even numbers from the user's input:

user_input = input('enter the numbers: ')
new_input = user_input.split()

length = 0
for i in new_input:
length = length + 1

for i in range(0, length):
new_input[i] = int(new_input[i])

even_num = []
for i in new_input:
if i % 2 == 0:
even_num.append(i)
print(even_num)

MARUTHU_
Автор

total = 0

for number in range(1, 101):
if number % 2 == 0:
total += number
print(number)

print(total)

devSackey
Автор

Mam waiting for Java classes.please do a videos on java after these python sessions

chandrakanth
Автор

x=range(0, 101, 2)
z=0
for a in x:
z=z+a
print(z)

girishbv
Автор

Ma'am but haven't included 1....
total=1
for i in range(0, 101, 2):
total=total+i
print(total)


OUTPUT : 2551

rplraibag
Автор

I always like your acttractive face and your eye teaching always dewana🎉

talahajamal
Автор

sum=0
for i in range(1, 101):
if i%2==0:
sum += i
print(sum)

DivyaVani-msnr
Автор

#second method
sum=0
for i in range(0, 101, 2):
sum += i
print(sum)

DivyaVani-msnr
Автор

but mam you said yourself 1 and 100 included but accroding to your code 2550 is sum of 2-100 (even number) you must add 1 there

Abhinay_CRX
Автор

sum=0
a=range(2, 101, 2)
for i in a:
sum=sum+i
print(sum)

Calculatorworld
Автор

But mam you didn't include 1 & 101

Arcanecosmicworld
Автор

Waiting for Advanced java classes....Please think of uploading it...

sandeep
Автор

Start the sessions on emerging technologies like aiml data science mam

ramavathnaveen
Автор

Mam please do the video of memory model tracing in python

Anushagraj-kdjq
Автор

1 bhi toh include hoga, aur sum hoga 2551...

poonam