#21 Python Tutorial for Beginners | For Loop in Python

  Рет қаралды 1,329,021

Telusko

Telusko

6 жыл бұрын

Check out our courses:
Enterprise Java Spring Microservices: go.telusko.com/enterpriseJava
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com/masterjava
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
Spring: go.telusko.com/udemyteluskosp...
Java:- go.telusko.com/udemyteluskojava
Java Spring:- go.telusko.com/Udemyjavaspring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopy...
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodo...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
In this lecture we are discussing about:
#1 break
#2 continue
#3 pass
In Python, break, continue, and pass are control flow statements that are used to
alter the normal flow of execution in a loop or conditional statement.
#1
break: The break statement is used to terminate a loop prematurely when a certain condition is met.
Once the break statement is encountered inside a loop, the loop is immediately terminated and the program continues
with the next statement after the loop.
for i in range(1, 6):
if i == 3:
break
print(i)
output:
1
2
#2
continue: The continue statement is used to skip the current iteration of a loop and move on to the next iteration,
without executing the remaining code in the loop for the current iteration.
for i in range(1, 6):
if i == 3:
continue
print(i)
output:
1
2
4
5
#3
pass: The pass statement is a placeholder statement that is used to indicate that no action should be taken. It is often used
as a placeholder when writing code that will be filled in later.
for i in range(1, 6):
if i == 3:
pass
else:
print(i)
output:
1
2
4
5
Github :- github.com/navinreddy20/Python-
Python for Beginners :- bit.ly/3JOLQhl
Editing Monitors :
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com

Пікірлер: 1 300
@kartikiyer3067
@kartikiyer3067 4 жыл бұрын
for i in range(1,500): if i**2
@BibekGhoshh1
@BibekGhoshh1 2 жыл бұрын
for i in range(1,500): if i**2
@shivaprasadbh6013
@shivaprasadbh6013 2 жыл бұрын
bro can i get explanation
@BibekGhoshh1
@BibekGhoshh1 2 жыл бұрын
@@shivaprasadbh6013 after getting all the posible output loop will break help us to come out from the loop..... otherwise it will check until the condition become false
@samrathot
@samrathot 2 жыл бұрын
@@BibekGhoshh1 the code does the same even without break in this case right? Ooh yeah got it! You're right without break there's increase in cost in terms of time. Thanks ✌️
@badugudineshchandra2610
@badugudineshchandra2610 2 жыл бұрын
from math import sqrt for i in range(1, 500, 1): a = int(sqrt(i)) if a == sqrt(i): print(i)
@ashitshekhar847
@ashitshekhar847 4 жыл бұрын
Hey Navin, you have explained the for loop in a very simple and easy to understand manner for a beginner. Thanks a lot.
@lovesick9907
@lovesick9907 3 жыл бұрын
Yeah I saw code with Harry’s video on this topic,he’s really made a hash of it
@randyelliott2494
@randyelliott2494 3 жыл бұрын
sorry to be off topic but does anyone know of a way to get back into an Instagram account? I was dumb forgot the password. I would appreciate any assistance you can give me
@shepardlucian4485
@shepardlucian4485 3 жыл бұрын
@Randy Elliott instablaster =)
@randyelliott2494
@randyelliott2494 3 жыл бұрын
@Shepard Lucian i really appreciate your reply. I got to the site thru google and I'm waiting for the hacking stuff now. Looks like it's gonna take quite some time so I will reply here later with my results.
@randyelliott2494
@randyelliott2494 3 жыл бұрын
@Shepard Lucian It did the trick and I actually got access to my account again. Im so happy:D Thank you so much you really help me out :D
@jessekyomuhendot4436
@jessekyomuhendot4436 4 жыл бұрын
Man I love your tutorials. You are using understandable words for beginners. A lot of people teaching coding out here are using some terminolgy that a beginner can't even understand.
@vishnushankartripathi450
@vishnushankartripathi450 3 жыл бұрын
It makes it so Easy to learn when there is a playlist instead of 1 six hour video
@aswasshsutar5367
@aswasshsutar5367 3 жыл бұрын
It's been two years but still I am learning from your page. Thank you so much Naveen Sir🙏
@haha44261
@haha44261 3 жыл бұрын
for i in range(1,50,1): import math as m if int(m.sqrt(i))==float(m.sqrt(i)): print(i)
@rishabhsharma3908
@rishabhsharma3908 3 жыл бұрын
could you explain it plz !
@mrpubg6561
@mrpubg6561 3 жыл бұрын
@@rishabhsharma3908 it will print the square of all numbers from 1 to 50
@tridevshrestha7124
@tridevshrestha7124 3 жыл бұрын
@@rishabhsharma3908 in if block, it will check square root of all number in both int and float.. lets suppose int(sqrt(4)) == float(sqrt(4.0)) but int(sqrt(5)) != float(sqrt(5.0)) because in int case , the result will be only 2 but in float case, result will be like this 2.23606797749979 which is not equal.
@rohitn6910
@rohitn6910 3 жыл бұрын
nice one Rishabh, as we can also have it without "import"
@code6233
@code6233 3 жыл бұрын
@@rohitn6910 how?
@amandamartinez7179
@amandamartinez7179 4 жыл бұрын
Thank you! I didn’t understand this at all and now it seems clear. Great teacher!
@DjCeez
@DjCeez Жыл бұрын
Thank you so much Navin! I totally appreciate the pace and thoroughness of your videos. I'll be watching!
@GurpreetSingh-gq4hx
@GurpreetSingh-gq4hx 3 жыл бұрын
Solution to quiz question: # To print perfect squares between 1 to 500 # Using for loop from math import* for i in range(1, 500): if int(sqrt(i)) ** 2 == i: print(i, end = ' ') # Using while loop from math import* i = 1 while i
@fitSarthak
@fitSarthak 2 жыл бұрын
Name error aa raha h sqrt kya kru?
@Akarsh-
@Akarsh- Жыл бұрын
for i in range(50): a = i * i if a
@Akarsh-
@Akarsh- Жыл бұрын
@@rishikavlogss It's at the end of the video around last 10 seconds
@bernardkimemia9471
@bernardkimemia9471 Жыл бұрын
Alternative solution from math import sqrt for num in range(1, 501): if sqrt(num).is_integer(): print(num)
@koushikkankala1873
@koushikkankala1873 Жыл бұрын
@@bernardkimemia9471 for i in range(1,501): if (i*i
@vainayak30
@vainayak30 5 жыл бұрын
import math for i in range(1,500): a=math.sqrt(i) if i%a==0: print(i, end=' ')
@DeshDeepak08
@DeshDeepak08 5 жыл бұрын
your code is correct and same my code
@adesinaolusegunabiola9615
@adesinaolusegunabiola9615 5 жыл бұрын
Thanks the code help me.... i have been on this for more than 3hrs but i got the hint fro your solution.
@nmewar
@nmewar 5 жыл бұрын
Can we do it without using math library...????
@KathakathanKarya
@KathakathanKarya 5 жыл бұрын
@@nmewar yep.... for i in range(1,500): for x in range(1,25): if i/x==x: print(i) i+=1 print()
@BoomcoreIsLive
@BoomcoreIsLive 5 жыл бұрын
@@nmewarmaybe
@hhcdghjjgsdrt235
@hhcdghjjgsdrt235 5 жыл бұрын
You are the best teacher cause a guy like me found your videos interesting as I'm a civil engineer.
@KunjaBihariKrishna
@KunjaBihariKrishna Жыл бұрын
There's so many videos for the basic python concepts, but I finally found someone who talks fast. When people talk too slow, it makes me nervous and agitated because I feel too much anticipation for what they're about to say. I have too much time to insert my own thoughts and it becomes harder to listen. When someone talks fast enough, the information is denser. Then I can relax and absorb. Fast talkers are soothing
@vivekojha4807
@vivekojha4807 5 жыл бұрын
i=1 while i
@GMENavneetPiyushDhal
@GMENavneetPiyushDhal 4 жыл бұрын
u r great sir ur way of teaching is just incredible
@siddharthgupta1058
@siddharthgupta1058 4 жыл бұрын
thats so mch btter teaching than my school teacher i have final exams coming this really helped me a lot. i had no idea of loops. i dont know why i had not seen you videos before
@user-sb4ne1rn5r
@user-sb4ne1rn5r 9 ай бұрын
you are teaching in a way that listeners can really enjoy coding .Thank you so much Navin.
@jayakumarpurushothama6473
@jayakumarpurushothama6473 5 жыл бұрын
# Print all perfect Square numbers between 1 to 500. # Note : for efficiency of program we have to break the loop to avoid 500 iteration. Observe this by using debug. Post 22 iterations if we dont break the loop it does unwanted 477 iterations and increase CPU cycles. for i in range(1,500): if (i**2
@harshavardhandsh5190
@harshavardhandsh5190 5 жыл бұрын
Few reply are also supportive...
@harishjagdale3893
@harishjagdale3893 4 жыл бұрын
this one is the best solution....Thanks!!
@bindassboss4842
@bindassboss4842 4 жыл бұрын
yes this is efficient program
@himanshushekhardas1730
@himanshushekhardas1730 4 жыл бұрын
we can take iteration upto 23, as 22^2 is less than 500
@DevendraSingh-xt2wn
@DevendraSingh-xt2wn 4 жыл бұрын
it's a very useful trick, but in general, if you have to check if a given number (x) is a perfect square number or not then how you would proceed?
@abhaysaini9136
@abhaysaini9136 4 жыл бұрын
Sirrr thankyou soooo much you are building humans future... Your teaching style and every thing is superb.... keeep it in pro level sir....god bless you... #2020👏🙏
@praveensamayam5620
@praveensamayam5620 4 жыл бұрын
you are a great tutor and any level of the guy can understand. Thanks for sharing your knowledge.
@deepssmeow
@deepssmeow 3 жыл бұрын
Amazing sir..this cleared all my doubts!! Thank you so much 🙏
@nidhigoswami2526
@nidhigoswami2526 4 жыл бұрын
Thanks a lot for this wonderful series, sir. It's easy and interesting. I have recommended it to my colleagues as well. They also love it.
@priyanshishukla6238
@priyanshishukla6238 4 жыл бұрын
for i in range(1,500): from math import sqrt root=sqrt(i) if int(root+0.5)**2==i: print(i)
@krishwanthkishore8299
@krishwanthkishore8299 2 жыл бұрын
Why did u print that fourth command ; if int( root + 0.5)**2==i . Why is that 0.5 needed ?
@Rajadahana
@Rajadahana 2 жыл бұрын
In range( ), when we are going in descending order, I realized the first number is included and the last number is excluded, just like when we go in ascending order. Nice to learn that as well.
@abhishekkakeri8994
@abhishekkakeri8994 3 жыл бұрын
Anna..... you are awesome!! No one can explain things this clearly!!
@patiencedery381
@patiencedery381 3 жыл бұрын
I really enjoy the way you teach; I understand the concept easily.
@badrit5153
@badrit5153 6 жыл бұрын
Thank you so much navin. My small suggestion after completion of video ur giving some home work we are ready to do tat work my request is in ur next video plz tell me tat ur answer for that question we will also able to know tat answer & if someone did mistake also tey will rectify. Not someone i am also one to do mistakes i am also able to rectify
@msrikavya9651
@msrikavya9651 4 жыл бұрын
Previous video homework is the example for next video
@eddyr978
@eddyr978 3 жыл бұрын
@@msrikavya9651 where is that please help i cant find it
@gautam_anup
@gautam_anup 3 жыл бұрын
Check out 100 days of code by Dr. Angela yu on udemy or app brewery. I'm learning from she teaches everything step by step. I'm sure you will get from 0 to a professional python developer after this course
@saulenisilaschisale5464
@saulenisilaschisale5464 5 жыл бұрын
of all the tutorials, yours are the best. i understand everything more than i do in class. thank you so much.
@mr8tweaker
@mr8tweaker 3 жыл бұрын
asli dakait boltee
@anusmitasamanta2608
@anusmitasamanta2608 4 жыл бұрын
Thank you so much sir.....ur way of teaching makes the thing more simpler :)
@vengamnaidu9273
@vengamnaidu9273 5 жыл бұрын
import math for i in range(1,int(math.sqrt(500))): print(i*i, end=" ")
@niftypliers
@niftypliers 4 жыл бұрын
This is perfect
@ritikagrawal892
@ritikagrawal892 3 жыл бұрын
perfect code with minimal complexity :-)
@riteshjat108
@riteshjat108 3 жыл бұрын
while running it is not showing 484 please tell me why?
@sandeepkumar3866
@sandeepkumar3866 3 жыл бұрын
@@riteshjat108. Here range means up to the value but not include that value that's why.
@riteshjat108
@riteshjat108 3 жыл бұрын
@@sandeepkumar3866 484 is very far from 500. What is the range you are talking about, I am not getting it.
@priteshwadhwa8833
@priteshwadhwa8833 5 жыл бұрын
using Math Function: import math for i in range(1,501): sq=math.sqrt(i) if i%sq==0: print('The Prefect Square root of number',i,'is',sq) -----------------------------OR------------------------- without Using Math Function: for i in range(1,501): sq=i**(1/2) if i%sq==0: print('The Prefect Square root of number',i,'is',sq)
@nikhilgupta2637
@nikhilgupta2637 5 жыл бұрын
thaks bro u also clear my doubt
@topgameplay4897
@topgameplay4897 3 жыл бұрын
I love your way of explaining,as you first do it wrong,then tell us the write method. Thank You 😀😀
@aishikg.5580
@aishikg.5580 4 жыл бұрын
Thanks a lot This was really helpful. I was searching all other places to learn some of these, then I found this and right when I saw the video I immedietly Subscribes and liked the video I think everyone else should subscribe and like and share. Keep Up The Great Work!!!
@poorna685
@poorna685 3 жыл бұрын
i was following codewithharry python tutorials,and i didnt get the for loop concept explained by him,but thankyou navin for explaining it much more clearly and simply
@faisal7980
@faisal7980 2 жыл бұрын
Same 👍
@hackwithprogramming7849
@hackwithprogramming7849 2 жыл бұрын
plz dont comparmise
@amansura8754
@amansura8754 2 жыл бұрын
Same bro what a coincidence
@kunalagrawal8084
@kunalagrawal8084 2 жыл бұрын
Same here
@isrogaganyaan6923
@isrogaganyaan6923 2 жыл бұрын
Same
@k.manideep2543
@k.manideep2543 5 жыл бұрын
from math import sqrt for i in range(1,501,1): a = sqrt(i) if(i%a == 0): print(i , end="")
@harshavardhandsh5190
@harshavardhandsh5190 5 жыл бұрын
Can you please Help me here # It should print found or not found... arr=array('i',[5,7,9]) print (arr) k =int(input('Enter the value to search')) for i in arr: if k==i: print('value found') break else: print('value not found')
@Viralwave143
@Viralwave143 6 ай бұрын
Being a pakistani and urdu speaker the way of your teaching is very easy thanks sir enjoying your tutorial
@ilovemyislam8748
@ilovemyislam8748 4 жыл бұрын
Sir you are the best python tutor I have seen till now
@TheOneMusketeer
@TheOneMusketeer 5 жыл бұрын
i = 1 while i**2
@NoraAlfraidi
@NoraAlfraidi 4 жыл бұрын
Nice
@sadatlucas4045
@sadatlucas4045 4 жыл бұрын
very easy ...the same 4rm the lesson...thanks sparta...
@1104944846
@1104944846 4 жыл бұрын
Not working
@janisilverlake0783
@janisilverlake0783 4 жыл бұрын
you didnt use the for looooooooop!
@nitinshenigaram6781
@nitinshenigaram6781 4 жыл бұрын
for i in range(100): if i*i
@NikSy
@NikSy 4 жыл бұрын
it is correct but it's better to add else: break statement also ,other wise your code will run unnecessarily
@rajas4072
@rajas4072 3 жыл бұрын
Sir you came in clutch for me I have my practical test tomorrow and I got to know about it today Thank you sir
@-Lauren-gs8mm
@-Lauren-gs8mm 2 ай бұрын
I was having huge confusion on loops and I'm literally searching for good explanation on loops atlast I was able to find one and got a clear understanding on this concept. Even though this video is if 5 years old still is was very useful in 2024.Thanks a lot.
@surabhirai3864
@surabhirai3864 3 жыл бұрын
Solution of the question at the end: import math for i in range(1,51): if math.sqrt(i) - (math.sqrt(i)//1) == 0: print(i)
@atulanand4249
@atulanand4249 3 жыл бұрын
Viewing at 0.75x
@aBhiViews1610
@aBhiViews1610 2 ай бұрын
True😂😂
@anjankumarkantepalli8623
@anjankumarkantepalli8623 2 ай бұрын
me at 2x...😅
@sumanjitkaur1462
@sumanjitkaur1462 3 жыл бұрын
I have been trying to understand this loop for years and today i understood it fully. Thanks for making this simple 😊
@meharkhan1235
@meharkhan1235 2 жыл бұрын
Thank you navin sir ...I was not getting that why the string in for loop is printing character one by one...just like you told by giving the example of your name...but u explained it so well...that now my confusion is all clear . So thank you so much sir...😊
@suramyaverma7063
@suramyaverma7063 5 жыл бұрын
import math i=1 while i
@varunakavoor
@varunakavoor 5 жыл бұрын
import math for i in range(1,500): perfect_square = pow(i,2) if perfect_square
@tommyshelbyobe9098
@tommyshelbyobe9098 2 жыл бұрын
Thanks for putting the solution in the comments 😅
@anshitasingla2334
@anshitasingla2334 2 жыл бұрын
Sir u r awsm i mean really , i print a pattern by my own first tym after learning two languages before this... Thank you sir for such wonderful tutorials.. 🤗🤗
@selmjm
@selmjm 3 жыл бұрын
thank you so muchhhh, i hope u're having a great journey!
@shiili7699
@shiili7699 4 жыл бұрын
ans: import math for i in range(1, 501): if math.sqrt(i) % 1 == 0: print(i)
@yogeshkumarshankariya642
@yogeshkumarshankariya642 4 жыл бұрын
Superb
@AnkitKumar-gg2zs
@AnkitKumar-gg2zs 4 жыл бұрын
Not working
@seemarajput779
@seemarajput779 4 жыл бұрын
after % their will be i maybe
@nalinmahajan1337
@nalinmahajan1337 4 жыл бұрын
from math import sqrt for i in range(1,501): if sqrt(i)==int(sqrt(i)) : print(i)
@mannythoughts5822
@mannythoughts5822 3 жыл бұрын
for i in range(1,501): print(i*i) try this one your code is not giving the square of last (500)
@imeneboumghar151
@imeneboumghar151 2 жыл бұрын
i would love if you did loop over more complicated data structures such as dataframe.. nice video
@vinitaarya6444
@vinitaarya6444 Жыл бұрын
Best explanation of for loop. Will never get confused. Thankyou so much
@arulvalananto
@arulvalananto 4 жыл бұрын
answer is: for i in range(1, 501, 1): if i**2
@muneraalkurbi4583
@muneraalkurbi4583 4 жыл бұрын
I feel it's not right to eliminate that one from the 500 even if it gives you the same result :)
@selinjodhani2634
@selinjodhani2634 4 жыл бұрын
from math import sqrt for i in range(1,501): if(i%(sqrt(i))==0): print(i)
@lochanahansini5700
@lochanahansini5700 2 жыл бұрын
Thank you!!! Lots of doubts on this loop disappeared. Thank you sir☺️
@vardaanthakur5513
@vardaanthakur5513 9 ай бұрын
yo, this video was really helpful for me , although I am watching this after 5 years but still got my answers , thank you !!!!!!
@varunkrishnaKyathanpally
@varunkrishnaKyathanpally 5 жыл бұрын
The answer to this quiz question is in the next video. for i in range(1, 500): i = i ** 2 if i >500: break print(i) Got this after trying it for couple of hrs :)
@vaibhavbopte9970
@vaibhavbopte9970 4 жыл бұрын
import math for i in range (1,51): square = i ** 2 print(square)
@kohlbovee7592
@kohlbovee7592 3 жыл бұрын
similarly: import math for i in range(1,501): if math.sqrt(i) % 1 == 0: print(i)
@kandras
@kandras 3 жыл бұрын
@@vaibhavbopte9970 what is import math? Is it the same to c lang lib math.h?
@sunilkar1692
@sunilkar1692 3 жыл бұрын
@@kohlbovee7592 can u please explain me the functioning of if line clearly? I am a bit confused 😕
@taehyungsmochisunshine6576
@taehyungsmochisunshine6576 3 жыл бұрын
how can people dislike this😲😭😔...you are sooo amazing sir...🥺❤️
@closethedoorman9158
@closethedoorman9158 3 жыл бұрын
yo ..army!!
@vijaychaitanya1183
@vijaychaitanya1183 3 жыл бұрын
awesome man..it directly hit my mind and understood instantly
@adishct4371
@adishct4371 Жыл бұрын
your explanation is very good sir, i have suggest your playlists to my other friends whose are learning websites.
@hoot2416
@hoot2416 3 жыл бұрын
I am taking a python class and your videos is helping me a lot. Thank you so much for this!
@gregoryopondi3652
@gregoryopondi3652 2 жыл бұрын
same
@deepkamalsingh636
@deepkamalsingh636 5 жыл бұрын
We are enjoying this series!!!!
@harshavardhandsh5190
@harshavardhandsh5190 5 жыл бұрын
Can you please Help me here # It should print found or not found... arr=array('i',[5,7,9]) print (arr) k =int(input('Enter the value to search')) for i in arr: if k==i: print('value found') break else: print('value not found')
@SantoshSahu-nd1bw
@SantoshSahu-nd1bw 5 жыл бұрын
for i in range(1,501): j=1 while(j*j
@asavtripple6
@asavtripple6 3 жыл бұрын
Thx you helped a lot out of all the videos i watched you were the best and made it easy to understand new subscriber thx bro
@kumaraakarshan6264
@kumaraakarshan6264 5 жыл бұрын
You're so helpful. I am learning at 11 and you teach so well.
@babyjarchive5823
@babyjarchive5823 5 жыл бұрын
Dont stop
@shubhamsingh8817
@shubhamsingh8817 4 жыл бұрын
import math for i in range(1,501) X=int(math.pow(i,2)) Y=int(math.sqrt(x)) if y==i and x
@aryaveergupta4269
@aryaveergupta4269 3 жыл бұрын
for i in range (1 ,23): print ("i**2) i think this is simpler
@shubhamsingh8817
@shubhamsingh8817 3 жыл бұрын
@@aryaveergupta4269 Ofcourse 👍🏻👍🏻 , that was me one year ago 😅.
@NoviceSibiandAnex
@NoviceSibiandAnex 5 жыл бұрын
You are fantastic. Born instructor!
@riteshjat108
@riteshjat108 3 жыл бұрын
from math import sqrt for x in range(1,500): if sqrt(x) == int(sqrt(x)): print(x,end=" ")
@Simsom
@Simsom 5 жыл бұрын
I saw that most people were doing the for loop from 1 to 500 which seemed a bit redundant to me. I set the for loop to go up to what I aproximated (cause I'm lazy that way) to be the closest number which multiplied by itself would result in a number close to 500, and in order to not go overboard with the results I used the if condition to only display the results less than 500 for i in range(1,25,1): if i**2 < 500: print(i**2)
@deeshantgupta3629
@deeshantgupta3629 3 жыл бұрын
Thank u sir ji Answer of Assignment from math import sqrt for i in range(51): if int(sqrt(i)) - sqrt(i) == 0: print(i)
@eventhorizon69
@eventhorizon69 Жыл бұрын
you explained it better than my schoolteacher. THANKYOU
@mrjh8467
@mrjh8467 4 жыл бұрын
Another excellent explanation. Highly encourage people who are studying python at college to definitely add these videos to supplement their learning.
@harshitsinghal6540
@harshitsinghal6540 5 жыл бұрын
from math import * for i in range(1,501): a=sqrt(i); if(i%a==0): print(i);
@actingstarchethan
@actingstarchethan 3 жыл бұрын
U made it much easier.... Lots of love from Karnataka
@syedalihasantaqialijaffry7883
@syedalihasantaqialijaffry7883 5 жыл бұрын
Hello sir i like tour way of teaching please upload java tutorial like the way you are teaching python so that it would be easier to understand more quickly
@hungamamachao7808
@hungamamachao7808 5 жыл бұрын
for i in range(1,501): y=i*i if y
@omsaichand9798
@omsaichand9798 5 жыл бұрын
from math import * n = [ ] for i in range(1, 501): n.append(sqrt(i)) for j in n: if j == int(j): print("%d"%(j*j)) else: continue
@Ajay-ug6do
@Ajay-ug6do 3 жыл бұрын
THAT 'S WAS WONDERFUL IT WAS VERY EASY TO UNDERSTAND THIS CONCEPT
@atexxxxx
@atexxxxx 3 жыл бұрын
This guy is really good!!!! Wow... It actually makes sense
@riserich
@riserich 5 жыл бұрын
for i in range(1,500): i *= i if i
@sameer281187
@sameer281187 5 жыл бұрын
Hey Richie, tried your version and it worked just fine. However the 2nd line in your code changes the value of i to (i) square and then when we iterate back to the for statement for next iteration, i is getting reset to the number in range. would like to confirm if this is something that range() offers us that it sets the variable back to its value in the range from the value that it attained during the running of program. Eg. When i=2, the 2nd line in the code sets the value of i to 4 but when we go back to the for statement after this iteration, i is reset to 3
@riserich
@riserich 5 жыл бұрын
@@sameer281187 Yes,thats how it suppose to happen. Eg. When i in range is 2 : i *= i is 4 ; i in range is 3 : i *= i is 9 ; i in range is 22 : i *= i is 484 . Since when the value of i >= 500 in i in range of 23, The if condition won't be calculated and no print is done anymore but still python will calculate for loop from 23 to 500. Thats why while loop is better for this assignment n = 1 i = 1 while i = 0: i = n*n n += 1 if i
@yashkhanna2602
@yashkhanna2602 6 жыл бұрын
import math for i in range(1,501): if(i**2
@varsinisivabalu9245
@varsinisivabalu9245 5 жыл бұрын
Why we are printing i**2??? Pls explain it..
@manojs6647
@manojs6647 5 жыл бұрын
** indicates power of , start from initial vedios
@krishashrimankar8390
@krishashrimankar8390 5 жыл бұрын
We dont need 'import math' here
@RohitSingh-zo8ci
@RohitSingh-zo8ci 5 жыл бұрын
It is wrong see the question b/w 500 not 501
@sreemanbadugu9781
@sreemanbadugu9781 5 жыл бұрын
@@varsinisivabalu9245 it means ** power so we are squaring it
@closethedoorman9158
@closethedoorman9158 3 жыл бұрын
sir the way you are teaching is awesome
@amitkabi
@amitkabi 5 жыл бұрын
for i in range(0,500,1): if i*i
@SuRaj-ho9dq
@SuRaj-ho9dq 4 жыл бұрын
Import math for i in range(500): If math.sqrt(i)%1==0: Print(i)
@hola_gracias165
@hola_gracias165 2 жыл бұрын
Best...The best... way to learn coding is by watching ur vdo.
@blinkoverhere4649
@blinkoverhere4649 Жыл бұрын
Your video really helped me thank you! I think you explain it well.
@ZinduZatism
@ZinduZatism 6 жыл бұрын
cannot wait for pattern teach us diamond and circle pls a d all shapes also pls teach us merge sort thank u
@msrikavya9651
@msrikavya9651 4 жыл бұрын
No
@pavitrataro2777
@pavitrataro2777 4 жыл бұрын
@@msrikavya9651 What no?
@jaheerkalanthar816
@jaheerkalanthar816 4 жыл бұрын
This is my first answer sir, num=1 for i in range(num,500): sqrt=num*num if sqrt
@mohammedazmathulla6474
@mohammedazmathulla6474 3 жыл бұрын
I am really enjoying it 😊the way "Navin" explains
@mathandsciencebestonlinele5260
@mathandsciencebestonlinele5260 4 жыл бұрын
import math as m for i in range(1,50): a=m.sqrt(i) if i%a==0: print(i) output: 1 4 9 16 25 36 49
@simranjitkaur5364
@simranjitkaur5364 4 жыл бұрын
After using this code the ouput coming is :- 1
@ishanthmishra7658
@ishanthmishra7658 4 жыл бұрын
For i in range (1,23) print (i**2) Note: Since 23 square is greater than 500 so value of i is restricted to 22
@VivekSingh-xf5pi
@VivekSingh-xf5pi 4 жыл бұрын
find perfect square not square of number bro
@vidhanshujain2413
@vidhanshujain2413 2 жыл бұрын
respect and the best content out there ... Thanku sooo much
@suhaskilche5646
@suhaskilche5646 3 жыл бұрын
amazing teaching sir i really understand all this concept very cearly..
@agirlfrom_mountains
@agirlfrom_mountains 5 жыл бұрын
Import math For I in range(1, 500): Print(math.pow(i, 2))
@adarshsahani1947
@adarshsahani1947 3 жыл бұрын
u can not use capital letter & it will print 1,4,9 upto 249001 which is not askesd.
@harshabasavaraju4609
@harshabasavaraju4609 4 жыл бұрын
for I in range (1,501): s=I*I If I
@danutharan9188
@danutharan9188 2 жыл бұрын
This is so simple and yet understand able sir.tqsm
@anumashankar6255
@anumashankar6255 4 жыл бұрын
I like ur videos...ur teaching was excellent...i am njoying ur videos...tqs for ur videos.... n ur expressing with good smile n Hearfully😀😀
@milanbariya4914
@milanbariya4914 4 жыл бұрын
Quiz Solution # Print all the perfect square number between 1 to 500. from math import sqrt, floor for i in range(1, 500): x = sqrt(i) if x - floor(x) == 0: print(i)
@kishankini3406
@kishankini3406 4 жыл бұрын
for i in range(1, 501) : if(i*i
@VikasKumar-ri7vr
@VikasKumar-ri7vr 4 жыл бұрын
bhai kaunho aap.I mean you are simply grt. Where the hell I was looking that i didint find you..you are the best chashmish tutor that i have come through yet. Dont find my compliment as a criticism. You are doing a great job and I wish that you make understand every logic or subject that comes through your way. plz bless us too.
#20 Python Tutorial for Beginners | While Loop in Python
12:43
Telusko
Рет қаралды 1,6 МЛН
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН
Jumping off balcony pulls her tooth! 🫣🦷
01:00
Justin Flom
Рет қаралды 28 МЛН
While Loop in Python | Python Tutorials for Beginners #lec50
26:51
Jenny's Lectures CS IT
Рет қаралды 71 М.
#26 Python Tutorial for Beginners | Array in Python
15:57
Telusko
Рет қаралды 1,3 МЛН
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 392 М.
Python For Loops - Programming for Beginners
5:19
Python Simplified
Рет қаралды 135 М.
Dictionary in Python
12:24
Telusko
Рет қаралды 1,3 МЛН
#23 Python Tutorial for Beginners | Printing Patterns in Python
7:56
Introduction to For Loops in Python (Python Tutorial #5)
10:22
CS Dojo
Рет қаралды 1,6 МЛН
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 288 М.
#samsung #retrophone #nostalgia #x100
0:14
mobijunk
Рет қаралды 14 МЛН
Новые iPhone 16 и 16 Pro Max
0:42
Romancev768
Рет қаралды 2,4 МЛН
Nokia 3310 top
0:20
YT 𝒯𝒾𝓂𝓉𝒾𝓀
Рет қаралды 4,1 МЛН