@Zak MB If you just increment start value by 1, you will get the answer: n1=int(input("Enter number1: ")) n2=int(input("Enter number2: ")) print("The numbers between them: ") for i in range(n1+1,n2): #The number starts from n1+1 and n2 is excluded by default print(i)
i know i am late in this video but i just started learning from yesterday and i am catching up pretty fast thanks to you guys. I was learning c from the website back then too.
Guys if u want to learn python this is the best content some one can give you this can even compete with paid course worth a thousand dollar. Glad got a teacher like you thanks for the videos
Great video ! I love the way you explain evereything, it all makes sense. Keep up the great vídeos ! I have a small feedback, I know that every video you teach us a new tool of programing that opens up a whole new universe of small projects that we can do to get better, and at the end of the video you give us a smal project "homework" but its always very oriented in training that specific tool, i think that at the end of every video you should give us 3 small but yet challenging projects that we will use everything that we learned until that point. Thank you so much for the awesome content, and i hope you understand what im saying.. im sorry for the bad english.. Much love from Brasil !! 🇧🇷👍
Thank you for your lessons! You 're explaining really very good. I solved the task,you gave at the end of the video and I was excited, when it ran and everything was correct.
total = sum(range(1, 101)) print(total) Easy way to do it in just 2 lines using the sum() function. Though its a shortcut that doesn't use a for-loop obviously.
Just liten carefully whatever sir told We have to print the result in such format that it is like Result=1+2+3+4+............+100 Not the sum of all those number
I wrote this!! # Sum of any range of numbers a = int(input("Input the first number in the range: ")) z = int(input("Input the last number in the range: ")) sum = 0 for i in range(a , z+1): sum += i i += 1 print(sum)
This was the first video I saw, and it was very much useful. And this is not the last video. Now I am gonna watch the complete playlist. Thanks. And keep uploading
sum = 0 for numbers in range(1,101): sum = sum + numbers print(sum,"=",end=" ") for number in range (1,100): print(number,"+",end=" ") print("100", end=" ")
idk if you'll ever see this comment python sensei but i want you to know you deserve great things in life your videos have helped me so much in my learning journey
n = int(input("Enter a number:")) for c in range(1, 11): p = n * c print(c,"x",n,"=",p) this is my first tables code with for loop and I've done it without seeing the real code
total = 0 # looping for summation of any series "x" to "y" x=int(input("enter the lower range : ")) y=int(input("enter the upper range : ")) for number in range(x,y+1): total = total + number print(total)
Great videos! You've made it easy to learn Python, especially coming from a background in C. I do have a quick question: towards the beginning of the video, you say that the string 'Python' has 7 characters. Does this include a null character, or was this simply a mistake? Thank you! :)
using range function:( i did it myself so I didn't see what was coming) number=int(input("Enter the number:")) for count in range(1, 11, 1): product=count*number print(count,"x", number,"=", product)
output: Enter the number:5 1 x 5 = 5 2 x 5 = 10 3 x 5 = 15 4 x 5 = 20 5 x 5 = 25 6 x 5 = 30 7 x 5 = 35 8 x 5 = 40 9 x 5 = 45 10 x 5 = 50 small note in (1,11,1), the first one is the starting, the 11 means upto 10 and 1 means(number of steps, i.e after 1, take 1+1=2, similar to count+=1)
Thank you very much for the awesome tutorials. Easily one of the best tutorials out there! One question, where is the github project you mention in the video? I can't find it in your comments or description.
number = int(input("Enter an integer: ")) for count in range(1, 100): product = number + count print(number, "+", count, "=", product) Provided: 1 / it should be this one code, if I am correct. If not - please correct me. Thanks!
limit = int(input("enter the limit")) current_number=0 next_number=1 for current_number in range (0,limit): sum = current_number+next_number current_number = sum next_number = sum+1 print(sum)
I have 2 string exercises which are making me hate programming with python from the heart as they are suppose to be as easy as returning 1+1. def pairs(txt): if len(txt)%2==0: right_indexes=list(range(1,len(txt),2)) print(right_indexes) left_indexes=list(range(0, len(txt), 2)) print(left_indexes) right_letters=map(list(txt).__getitem__,right_indexes) left_letters=map(list(txt).__getitem__,left_indexes) pairs=list(zip(left_letters,right_letters)) return pairs I've ended up creating this list of paired tuples thinking it might help me understand better as I noticed how comparing 2 things next to each other. Because if the number of things is odd at the right side edge, it's not easy for me to know what to do. But it's not helping me to solve these very simple problems as I have no idea how to implement a for or while loop from pairs [(A,B),(B,C),(A,B),(C,C),(C,D)] for these 2 exercises: 1)Make a function that removes letters that are alone. Like if you have like ABBCABCCCD it would return BBCCC 2)Make another function which does the opposite turning like ABBCABCCC returns ACABD removing duplicates alight together (not just all). my brain only works to turn the whole thing into a set... ;____; When things are like this and you truly have to understand loops.... plus conversion as one is suppose to input a string and output should be a string.... I really feel like I'm the dumbest person alife Please help me solve these.
Hi, I used the for statement for the assignment, and this is my answer: count = 0 total = 0 for count in range(0, 100): total = total + count count = count + 1 total1 = total + count print(total, "+", count, "=", total1) total thank you
Your tutorials are very clear! Thanks for sharing your knowledge. Would there be a way to identify if the value entered is not an integer and show a message in that case, if not, do and show the sum? Thanks
For anyone watching this video in 2023 (soon to be 2024): Here is the homework answer if you want it :> : number = 0 for number in range(0,100): number = number+1 print(number) Explanation : So we will always start from 0 to obtain the next number. And as explained in the video, we take the range as well. So after that since we gave our beginning value of number '0', '0' + 1 = 1. And this will continue till the range is satisfied. This is the magic of for loop! If somebody didnt understand, I am so sorry. Maybe I shouldnt be a teacher 😃
Learning Python is something you would like to get in your skills, but you do not know where to start? This NEW channel will help you out leaning Python Programming from scratch - for complete Beginners, Intermediate and Advanced Levels
_*Your Programming Task:- number = int(input("Enter the integer")) for count in range(1, 101) : sum = number + count print(number, "+", count, "=", sum)
Thanks for your clear enlightenment on python. But mine did not work has yours did. It only took the last digit of the series of number who in my case was 20. This is my code Number = int(input("Enter an integer:")) Product=number*count Print(number, "X", count, "=", product)
The count variable is declared in the first line of the loop. # notice count variable in for count in range(1, 10): for count in range(1, 10): print(count)
Hi, thanks for sharing the knowledge. I have tried the counting program for num in range(1,11) sum=sum+num print(sum) when i say print, it is printing for sum value for every iteration, but if i need to print only the last sum value, can you please let me know how to do it
I geess this is one month older thread though, this is how I did it. sum(list(range(101))) I am a beginner, and I feel like I am missing something.... It does its job though, right?
wait so is whatever you write between the for and in functions followed with a range, means nothing? No matter what I write down it will keep on going down the list of range. But I can't leave it blank either?
yes, since it is like a variable, that you normally assign value to, they cannot start with number and cannot have space in between the name, and can only contain (A-z, 0-9, and _ )
#PROGRAM TO FIND THE SUM OF GIVEN NATURAL NUMBERS ans = 0 num = int(input("ENTER THE NUMBER = ")) print("ANSWER = ") for count in range(1,num+1): print("step",count,"=",ans,"+",count) ans = ans + count print("Total answer =",ans)
🔥 Learn Python with a more hands-on experience with Programiz PRO-interactive lessons, quizzes & challenges.
Try Programiz PRO: bit.ly/right-python
Hey Guys! At 0:45, there is a minor error on our part. "Python" is a sequence of 6 characters, not 7.
No its true. PYTHO&N
I count 7 characters in my sequence
"Python🐍"
@Zak MB If you just increment start value by 1, you will get the answer:
n1=int(input("Enter number1: "))
n2=int(input("Enter number2: "))
print("The numbers between them: ")
for i in range(n1+1,n2): #The number starts from n1+1 and n2 is excluded by default
print(i)
This channel is really underrated, such good content.
i know i am late in this video but i just started learning from yesterday and i am catching up pretty fast thanks to you guys. I was learning c from the website back then too.
This code isn't correct in answering the video's question. Look at the example he gives in his link if you haven't already.
Guys if u want to learn python this is the best content some one can give you this can even compete with paid course worth a thousand dollar. Glad got a teacher like you thanks for the videos
Great video ! I love the way you explain evereything, it all makes sense. Keep up the great vídeos ! I have a small feedback, I know that every video you teach us a new tool of programing that opens up a whole new universe of small projects that we can do to get better, and at the end of the video you give us a smal project "homework" but its always very oriented in training that specific tool, i think that at the end of every video you should give us 3 small but yet challenging projects that we will use everything that we learned until that point. Thank you so much for the awesome content, and i hope you understand what im saying.. im sorry for the bad english.. Much love from Brasil !! 🇧🇷👍
True, We need some challenging one's
Hi Raphael! Good to know that you are enjoying our videos. We will take your feedback into consideration while creating new videos. Thanks.
for i in range (1, 100):
print(i, "+", end=" ")
print(100, end=" ")
print("=", sum (range(1,101)))
A much easier way to do it is:
sum = sum(range(1, 101))
print(sum)
@@SharkSnuggie sum is a built in function and you can use it as a variable?? dang.. that's crazy.
@@chomeboy yes you can use it as a variable
@SharkSnuggie easier way:
n=100
print(n*(n+1)/2)
Thank you for your lessons! You 're explaining really very good. I solved the task,you gave at the end of the video and I was excited, when it ran and everything was correct.
Highly underrated channel, thanks a lot pal!
7:23
n = int(input("enter the limit"))
i=0
j=1
for i in range (0,n):
sum = i+j
i= sum
j= sum+1
print(sum)
total = sum(range(1, 101))
print(total)
Easy way to do it in just 2 lines using the sum() function. Though its a shortcut that doesn't use a for-loop obviously.
Figured it out
' ' '
number = 1
total = 0
for number in range(1,101)
total = number + total
print(total)
' ' '
Not too bad, but a little brain tease.
Just liten carefully whatever sir told
We have to print the result in such format that it is like
Result=1+2+3+4+............+100
Not the sum of all those number
I wrote this!!
# Sum of any range of numbers
a = int(input("Input the first number in the range: "))
z = int(input("Input the last number in the range: "))
sum = 0
for i in range(a , z+1):
sum += i
i += 1
print(sum)
Thanks sir 👍
Keep uploading...I am regular viewer!!
This was the first video I saw, and it was very much useful. And this is not the last video. Now I am gonna watch the complete playlist. Thanks. And keep uploading
thaks a lot everything clearer than my professor's telling xD
You are a genius and a great professor! Thanks a lot!
Your video's are very nice you explain it very nicely i made soo many programs on python by only watching your video it helped me alot Thank you bro
loved the way of teaching , as well as the content
Man you are born to teach.. even a 5 years old can understand you..
sum = 0
for numbers in range(1,101):
sum = sum + numbers
print(sum,"=",end=" ")
for number in range (1,100):
print(number,"+",end=" ")
print("100", end=" ")
Output:
5050 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100
So simply explained. Unbelievable. Thanx boss!
idk if you'll ever see this comment python sensei but i want you to know you deserve great things in life your videos have helped me so much in my learning journey
def numsum():
sum=0
for current_number in range(0,101):
sum = current_number + sum
print(sum)
for loop in range (1,100000):
if loop == 1:
num2=0
num1=num2
num2=loop+num1
if loop ==100:
print(num2)
sum=0
for count in range(1,101):
sum=sum+count
print(sum)
Awesome lecturing brother 👍👍
n = int(input("Enter a number:"))
for c in range(1, 11):
p = n * c
print(c,"x",n,"=",p) this is my first tables code with for loop and I've done it without seeing the real code
number = range(1,101)
For a in number:
print (a,"+",end="")
Nice Bro
total = 0
# looping for summation of any series "x" to "y"
x=int(input("enter the lower range : "))
y=int(input("enter the upper range : "))
for number in range(x,y+1):
total = total + number
print(total)
sum_num = 0
for i in range(1, 101):
sum_num = sum_num + i
print(sum_num)
Great video👍, the way of your explanation is very good👌, all concepts are clear.
Awesome Explanation Brother
Great videos! You've made it easy to learn Python, especially coming from a background in C. I do have a quick question: towards the beginning of the video, you say that the string 'Python' has 7 characters. Does this include a null character, or was this simply a mistake? Thank you! :)
Oh! It's an error on our part. "Python" is a sequence of 6 characters, not 7. And, they do not end with the null character like in C programming.
@@programizstudios Thank you for the clarification! :)
using range function:( i did it myself so I didn't see what was coming)
number=int(input("Enter the number:"))
for count in range(1, 11, 1):
product=count*number
print(count,"x", number,"=", product)
output:
Enter the number:5
1 x 5 = 5
2 x 5 = 10
3 x 5 = 15
4 x 5 = 20
5 x 5 = 25
6 x 5 = 30
7 x 5 = 35
8 x 5 = 40
9 x 5 = 45
10 x 5 = 50
small note in (1,11,1), the first one is the starting, the 11 means upto 10 and 1 means(number of steps, i.e after 1, take 1+1=2, similar to count+=1)
Thank you very much for the awesome tutorials. Easily one of the best tutorials out there! One question, where is the github project you mention in the video? I can't find it in your comments or description.
number = int(input("Enter an integer: "))
for count in range(1, 100):
product = number + count
print(number, "+", count, "=", product)
Provided: 1 / it should be this one code, if I am correct. If not - please correct me. Thanks!
To find Sum from 1 to 100 why you are taking number?
you are such a great on python
Spoiler for the task
I did it like this
n = 1
w = 0
While n
2:33 It's not working.....I wrote the exactly same program in programiz python compiler and its no running but saying "invalid syntax''
number = int(input("Enter any number"))
for count in range(1,11):
sum = number + count
print(number,"+",count,"=",sum)
this is not a correct answer for the above question
limit = int(input("enter the limit"))
current_number=0
next_number=1
for current_number in range (0,limit):
sum = current_number+next_number
current_number = sum
next_number = sum+1
print(sum)
not working properly, :-(
I have 2 string exercises which are making me hate programming with python from the heart as they are suppose to be as easy as returning 1+1.
def pairs(txt):
if len(txt)%2==0:
right_indexes=list(range(1,len(txt),2))
print(right_indexes)
left_indexes=list(range(0, len(txt), 2))
print(left_indexes)
right_letters=map(list(txt).__getitem__,right_indexes)
left_letters=map(list(txt).__getitem__,left_indexes)
pairs=list(zip(left_letters,right_letters))
return pairs
I've ended up creating this list of paired tuples thinking it might help me understand better as I noticed how comparing 2 things next to each other. Because if the number of things is odd at the right side edge, it's not easy for me to know what to do.
But it's not helping me to solve these very simple problems as I have no idea how to implement a for or while loop from pairs [(A,B),(B,C),(A,B),(C,C),(C,D)] for these 2 exercises:
1)Make a function that removes letters that are alone. Like if you have like ABBCABCCCD it would return BBCCC
2)Make another function which does the opposite turning like ABBCABCCC returns ACABD removing duplicates alight together (not just all).
my brain only works to turn the whole thing into a set... ;____; When things are like this and you truly have to understand loops.... plus conversion as one is suppose to input a string and output should be a string.... I really feel like I'm the dumbest person alife
Please help me solve these.
Here it is...
Print("result")
For i in range(1,100):
Print(i,end="+")
Print(i+1)
Thank you so much. This video was very helpful!
your videos are always helpful heartly thanks
Bro, you make things easier 🙏
Thank you for explaining the concept simply. it is awesome
Code to find sum upto any number
n=int(input("Enter the number:"))
for i in range(0, n+1, 1):
i*=(n+1)/2
print("The sum from 0 to", n, "is:",int( i))
Hi, I used the for statement for the assignment, and this is my answer:
count = 0
total = 0
for count in range(0, 100):
total = total + count
count = count + 1
total1 = total + count
print(total, "+", count, "=", total1)
total
thank you
no the out put must be in the format of 1+2+3+4....+100
and when you type range(0,100) the out put ends at 99 so we have to type range(0,101)
Kya batoo bhut achha tutorial h bahi keep it up
count=1
number=2
while count
Your tutorials are very clear! Thanks for sharing your knowledge.
Would there be a way to identify if the value entered is not an integer and show a message in that case, if not, do and show the sum?
Thanks
For anyone watching this video in 2023 (soon to be 2024):
Here is the homework answer if you want it :> :
number = 0
for number in range(0,100):
number = number+1
print(number)
Explanation :
So we will always start from 0 to obtain the next number. And as explained in the video, we take the range as well. So after that since we gave our beginning value of number '0', '0' + 1 = 1. And this will continue till the range is satisfied. This is the magic of for loop!
If somebody didnt understand, I am so sorry. Maybe I shouldnt be a teacher 😃
sir mai python aapki website sai krta hoon vahan zyada syllabus hai yahan sai pr mujhe vahan literals nhi samajh aa rha aap us pr video bnaugai??
sum=0
for i in range (1,101):
sum=sum+i
print(sum)
But this not work bro
Learning Python is something you would like to get in your skills, but you do not know where to start? This NEW channel will help you out leaning Python Programming from scratch - for complete Beginners, Intermediate and Advanced Levels
well explained, keep up the good work bro.
You’re brilliant - thank you :)
This guy is the 🐐
number = range(1,101)
for i in range(len(number)):
print(number[i], end='+')
_*Your Programming Task:-
number = int(input("Enter the integer"))
for count in range(1, 101) :
sum = number + count
print(number, "+", count, "=", sum)
this is wrong , no one have provided the correct answer in comment section
Thank you so much sir👍
a=sum(range(1,101))
print(a)
Got 5050 :3
Not only python, but it is also better to make a video tutorial playlist on other programming languages like kotlin, swift, etc
Well he just started making videos, he cant upload 100's videos at once
@@xrhstos1330 is he the only one, then he should hire someone as interns
@@sanajayakrishna if you want to see videos for a language from someone else, you could also find another yt channel.
Thank you for this tutorial.
Thanks for your clear enlightenment on python.
But mine did not work has yours did. It only took the last digit of the series of number who in my case was 20.
This is my code
Number = int(input("Enter an integer:"))
Product=number*count
Print(number, "X", count, "=", product)
Thank you sir 🙏 ☺
result = 0
for num in range(1, 101):
result += num
if num < 100:
print(num, "+ ", end="")
else:
print(num, end="")
print(" =", result)
a = 0
for b in range(0,101):
a = a + b
print(a)
thanks
number = int(input("enter a number:"))
for count in range (1, 101):
product = number + count
print(number, "+", count, "=", product)
infact kudos to you Punit and your team for such a great tutorial on python for beginners ! it is very clear and easy to follow
6:05 i am confused u have not declared the count variable and yet its showing the desired output. pls reply
The count variable is declared in the first line of the loop.
# notice count variable in for count in range(1, 10):
for count in range(1, 10):
print(count)
ok understood ...thank you
this video was very helpful!
Can you please give the answers to the task you gave us at 7:22 and the other ones you gave in other vids.
love you bro nice class
Please teach C also
Great video!
Understood everything
Hi, thanks for sharing the knowledge. I have tried the counting program
for num in range(1,11)
sum=sum+num
print(sum)
when i say print, it is printing for sum value for every iteration, but if i need to print only the last sum value, can you please let me know how to do it
got it, we need to place the print statement out of the loop
I geess this is one month older thread though, this is how I did it. sum(list(range(101))) I am a beginner, and I feel like I am missing something.... It does its job though, right?
number = int(input('Enter a number for sum'))
count = 1
for count in range (1,101):
sum = number+count
print(number, "+", count, "=" , sum)
sum = 0
for count in range(1, 101):
sum=sum+count
Print("sum is:", sum)
my answer
number=int(input('Enter number:'))
for sequence in range(1,101):
sum=number+sequence
print(number,'+',sequence,'=',sum)
sum=0
for count in range(1,101):
sum=sum + count
print("sum of 1 to 100 is=",sum)
Good presentation buddy
great explanation
Plz solve the practice question from while loop
number = 100
product = 0
for sum in range(1, number + 1):
product = product + sum
print(product)
wait so is whatever you write between the for and in functions followed with a range, means nothing? No matter what I write down it will keep on going down the list of range. But I can't leave it blank either?
yes, since it is like a variable, that you normally assign value to, they cannot start with number and cannot have space in between the name, and can only contain (A-z, 0-9, and _ )
Can you pls paste the link of github repository to find the programming the examples or more samples to work on
this is the hardest thing ive learnt so far
I want , please give a video on list, tuple, set and dictionary using for loop
Thank you !
you are genius
For result in range(1,101):
Sum= i + result
Result += 1
Print(sum)
Here i is not defined any where how its run
Thanks to you
how do we do this in a loop
Accept names of 5 colours from the user and store it in list called ‘colours’.
bro you are awesome by watching your videos i am feeling confident to give my practical
love the videos bro
number=0
for number in range(0,100):
value=number+1
print(value,"+")
You making a 14 years old learn python. 🐨
what do you mean bro.... not getting it?
@@shankarsai2067 he is trying to say he don't know how to use A computer
answer:
**x = 0
for i in range (1,101):
x =+ i
print(i)**
#PROGRAM TO FIND THE SUM OF GIVEN NATURAL NUMBERS
ans = 0
num = int(input("ENTER THE NUMBER = "))
print("ANSWER = ")
for count in range(1,num+1):
print("step",count,"=",ans,"+",count)
ans = ans + count
print("Total answer =",ans)