#21 Python Tutorial for Beginners | For Loop in Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2018
  • Check out our courses:
    Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : bit.ly/java-spring-cloud
    Udemy Courses:
    Java:- bit.ly/JavaUdemyTelusko
    Spring:- bit.ly/SpringUdemyTelusko
    Java For Programmers:- bit.ly/javaProgrammers
    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.2K

  • @kartikiyer3067
    @kartikiyer3067 4 ปีที่แล้ว +58

    for i in range(1,500):
    if i**2

    • @BibekGhoshh1
      @BibekGhoshh1 2 ปีที่แล้ว +8

      for i in range(1,500):
      if i**2

    • @shivaprasadbh6013
      @shivaprasadbh6013 2 ปีที่แล้ว

      bro can i get explanation

    • @BibekGhoshh1
      @BibekGhoshh1 2 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +3

      from math import sqrt
      for i in range(1, 500, 1):
      a = int(sqrt(i))
      if a == sqrt(i):
      print(i)

  • @ashitshekhar847
    @ashitshekhar847 3 ปีที่แล้ว +190

    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 2 ปีที่แล้ว +2

      Yeah I saw code with Harry’s video on this topic,he’s really made a hash of it

    • @randyelliott2494
      @randyelliott2494 2 ปีที่แล้ว

      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 2 ปีที่แล้ว

      @Randy Elliott instablaster =)

    • @randyelliott2494
      @randyelliott2494 2 ปีที่แล้ว

      @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 2 ปีที่แล้ว

      @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 ปีที่แล้ว +35

    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.

  • @atulanand4249
    @atulanand4249 3 ปีที่แล้ว +32

    Viewing at 0.75x

  • @vishnushankartripathi450
    @vishnushankartripathi450 3 ปีที่แล้ว +26

    It makes it so Easy to learn when there is a playlist instead of 1 six hour video

  • @haha44261
    @haha44261 3 ปีที่แล้ว +35

    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 ปีที่แล้ว +2

      could you explain it plz !

    • @mrpubg6561
      @mrpubg6561 3 ปีที่แล้ว +2

      @@rishabhsharma3908 it will print the square of all numbers from 1 to 50

    • @tridevshrestha7124
      @tridevshrestha7124 3 ปีที่แล้ว +5

      @@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 ปีที่แล้ว +1

      nice one Rishabh, as we can also have it without "import"

    • @code6233
      @code6233 3 ปีที่แล้ว

      @@rohitn6910 how?

  • @vainayak30
    @vainayak30 5 ปีที่แล้ว +226

    import math
    for i in range(1,500):
    a=math.sqrt(i)
    if i%a==0:
    print(i, end=' ')

    • @DeshDeepak08
      @DeshDeepak08 5 ปีที่แล้ว +2

      your code is correct and same my code

    • @adesinaolusegunabiola9615
      @adesinaolusegunabiola9615 5 ปีที่แล้ว +6

      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 ปีที่แล้ว +9

      Can we do it without using math library...????

    • @KathakathanKarya
      @KathakathanKarya 5 ปีที่แล้ว +22

      @@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 ปีที่แล้ว +2

      @@nmewarmaybe

  • @aswasshsutar5367
    @aswasshsutar5367 3 ปีที่แล้ว +29

    It's been two years but still I am learning from your page.
    Thank you so much Naveen Sir🙏

  • @jayakumarpurushothama6473
    @jayakumarpurushothama6473 5 ปีที่แล้ว +135

    # 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 ปีที่แล้ว +3

      Few reply are also supportive...

    • @harishjagdale3893
      @harishjagdale3893 4 ปีที่แล้ว +5

      this one is the best solution....Thanks!!

    • @bindassboss4842
      @bindassboss4842 4 ปีที่แล้ว +1

      yes this is efficient program

    • @himanshushekhardas1730
      @himanshushekhardas1730 4 ปีที่แล้ว +2

      we can take iteration upto 23, as 22^2 is less than 500

    • @DevendraSingh-xt2wn
      @DevendraSingh-xt2wn 4 ปีที่แล้ว +1

      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?

  • @GurpreetSingh-gq4hx
    @GurpreetSingh-gq4hx 3 ปีที่แล้ว +15

    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- ปีที่แล้ว +1

      for i in range(50):
      a = i * i
      if a

    • @Akarsh-
      @Akarsh- ปีที่แล้ว

      @@Codeequest It's at the end of the video around last 10 seconds

    • @bernardkimemia9471
      @bernardkimemia9471 ปีที่แล้ว +1

      Alternative solution
      from math import sqrt
      for num in range(1, 501):
      if sqrt(num).is_integer():
      print(num)

    • @koushikkankala1873
      @koushikkankala1873 11 หลายเดือนก่อน +1

      @@bernardkimemia9471 for i in range(1,501):
      if (i*i

  • @amandamartinez7179
    @amandamartinez7179 4 ปีที่แล้ว +3

    Thank you! I didn’t understand this at all and now it seems clear. Great teacher!

  • @priyanshishukla6238
    @priyanshishukla6238 3 ปีที่แล้ว +7

    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 ?

  • @GMENavneetPiyushDhal
    @GMENavneetPiyushDhal 4 ปีที่แล้ว +6

    u r great sir ur way of teaching is just incredible

  • @priteshwadhwa8833
    @priteshwadhwa8833 5 ปีที่แล้ว +19

    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)

  • @hhcdghjjgsdrt235
    @hhcdghjjgsdrt235 5 ปีที่แล้ว +2

    You are the best teacher cause a guy like me found your videos interesting as I'm a civil engineer.

  • @DjCeez
    @DjCeez ปีที่แล้ว

    Thank you so much Navin! I totally appreciate the pace and thoroughness of your videos. I'll be watching!

  • @vengamnaidu9273
    @vengamnaidu9273 5 ปีที่แล้ว +20

    import math
    for i in range(1,int(math.sqrt(500))):
    print(i*i, end=" ")

    • @niftypliers
      @niftypliers 4 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@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.

  • @vivekojha4807
    @vivekojha4807 5 ปีที่แล้ว +7

    i=1
    while i

  • @abhishekkakeri8994
    @abhishekkakeri8994 3 ปีที่แล้ว

    Anna..... you are awesome!! No one can explain things this clearly!!

  • @siddharthgupta1058
    @siddharthgupta1058 4 ปีที่แล้ว +3

    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

  • @TheOneMusketeer
    @TheOneMusketeer 5 ปีที่แล้ว +28

    i = 1
    while i**2

    • @NoraAlfraidi
      @NoraAlfraidi 4 ปีที่แล้ว +1

      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!

  • @abhaysaini9136
    @abhaysaini9136 4 ปีที่แล้ว +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👏🙏

  • @deepssmeow
    @deepssmeow 3 ปีที่แล้ว +2

    Amazing sir..this cleared all my doubts!! Thank you so much 🙏

  • @KunjaBihariKrishna
    @KunjaBihariKrishna ปีที่แล้ว +1

    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

  • @poorna685
    @poorna685 3 ปีที่แล้ว +23

    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

  • @nitinshenigaram6781
    @nitinshenigaram6781 4 ปีที่แล้ว +5

    for i in range(100):
    if i*i

    • @NikSy
      @NikSy 4 ปีที่แล้ว +1

      it is correct but it's better to add
      else:
      break
      statement also ,other wise your code will run unnecessarily

  • @praveensamayam5620
    @praveensamayam5620 4 ปีที่แล้ว

    you are a great tutor and any level of the guy can understand. Thanks for sharing your knowledge.

  • @user-sb4ne1rn5r
    @user-sb4ne1rn5r 7 หลายเดือนก่อน +1

    you are teaching in a way that listeners can really enjoy coding .Thank you so much Navin.

  • @saulenisilaschisale5464
    @saulenisilaschisale5464 5 ปีที่แล้ว +8

    of all the tutorials, yours are the best. i understand everything more than i do in class. thank you so much.

  • @harshitsinghal6540
    @harshitsinghal6540 5 ปีที่แล้ว +7

    from math import *
    for i in range(1,501):
    a=sqrt(i);
    if(i%a==0):
    print(i);

  • @Rajadahana
    @Rajadahana 2 ปีที่แล้ว +1

    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.

  • @anusmitasamanta2608
    @anusmitasamanta2608 4 ปีที่แล้ว +1

    Thank you so much sir.....ur way of teaching makes the thing more simpler :)

  • @badrit5153
    @badrit5153 5 ปีที่แล้ว +83

    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 ปีที่แล้ว +1

      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

  • @varunakavoor
    @varunakavoor 5 ปีที่แล้ว +4

    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 😅

  • @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

  • @selmjm
    @selmjm 3 ปีที่แล้ว

    thank you so muchhhh, i hope u're having a great journey!

  • @patiencedery381
    @patiencedery381 3 ปีที่แล้ว +12

    I really enjoy the way you teach; I understand the concept easily.

  • @k.manideep2543
    @k.manideep2543 5 ปีที่แล้ว +6

    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')

  • @topgameplay4897
    @topgameplay4897 3 ปีที่แล้ว

    I love your way of explaining,as you first do it wrong,then tell us the write method.
    Thank You 😀😀

  • @ilovemyislam8748
    @ilovemyislam8748 4 ปีที่แล้ว

    Sir you are the best python tutor I have seen till now

  • @nalinmahajan1337
    @nalinmahajan1337 4 ปีที่แล้ว +5

    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)

  • @surabhirai3864
    @surabhirai3864 3 ปีที่แล้ว +4

    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)

  • @riteshjat108
    @riteshjat108 3 ปีที่แล้ว +2

    from math import sqrt
    for x in range(1,500):
    if sqrt(x) == int(sqrt(x)):
    print(x,end=" ")

  • @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.. 🤗🤗

  • @shiili7699
    @shiili7699 4 ปีที่แล้ว +8

    ans:
    import math
    for i in range(1, 501):
    if math.sqrt(i) % 1 == 0:
    print(i)

  • @nidhigoswami2526
    @nidhigoswami2526 4 ปีที่แล้ว +5

    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.

  • @lochanahansini5700
    @lochanahansini5700 2 ปีที่แล้ว

    Thank you!!! Lots of doubts on this loop disappeared. Thank you sir☺️

  • @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...😊

  • @varunkrishnaKyathanpally
    @varunkrishnaKyathanpally 4 ปีที่แล้ว +23

    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 ปีที่แล้ว +1

      import math
      for i in range (1,51):
      square = i ** 2
      print(square)

    • @kohlbovee7592
      @kohlbovee7592 3 ปีที่แล้ว +6

      similarly:
      import math
      for i in range(1,501):
      if math.sqrt(i) % 1 == 0:
      print(i)

    • @kandras
      @kandras 3 ปีที่แล้ว +1

      @@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 😕

  • @suramyaverma7063
    @suramyaverma7063 4 ปีที่แล้ว +3

    import math
    i=1
    while i

  • @aishikg.5580
    @aishikg.5580 4 ปีที่แล้ว +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!!!

  • @the_devilslettuce1320
    @the_devilslettuce1320 3 ปีที่แล้ว

    this is absolutely amazing.Thank you!

  • @arulvalananto
    @arulvalananto 4 ปีที่แล้ว +5

    answer is:
    for i in range(1, 501, 1):
    if i**2

    • @muneraalkurbi4583
      @muneraalkurbi4583 3 ปีที่แล้ว

      I feel it's not right to eliminate that one from the 500 even if it gives you the same result :)

  • @taehyungsmochisunshine6576
    @taehyungsmochisunshine6576 3 ปีที่แล้ว +6

    how can people dislike this😲😭😔...you are sooo amazing sir...🥺❤️

  • @NoviceSibiandAnex
    @NoviceSibiandAnex 5 ปีที่แล้ว +1

    You are fantastic. Born instructor!

  • @vinitaarya6444
    @vinitaarya6444 ปีที่แล้ว

    Best explanation of for loop. Will never get confused. Thankyou so much

  • @yashkhanna2602
    @yashkhanna2602 6 ปีที่แล้ว +20

    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 ปีที่แล้ว +1

      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

  • @shubhamsingh8817
    @shubhamsingh8817 4 ปีที่แล้ว +3

    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 ปีที่แล้ว +4

      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 😅.

  • @imeneboumghar151
    @imeneboumghar151 2 ปีที่แล้ว +2

    i would love if you did loop over more complicated data structures such as dataframe.. nice video

  • @sumanjitkaur1462
    @sumanjitkaur1462 3 ปีที่แล้ว +2

    I have been trying to understand this loop for years and today i understood it fully. Thanks for making this simple 😊

  • @deepkamalsingh636
    @deepkamalsingh636 5 ปีที่แล้ว +4

    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')

  • @pallavisaggar4396
    @pallavisaggar4396 5 ปีที่แล้ว

    You explain so well ! Thanks !

  • @vijaychaitanya1183
    @vijaychaitanya1183 3 ปีที่แล้ว

    awesome man..it directly hit my mind and understood instantly

  • @hoot2416
    @hoot2416 3 ปีที่แล้ว +3

    I am taking a python class and your videos is helping me a lot. Thank you so much for this!

  • @kumaraakarshan6264
    @kumaraakarshan6264 5 ปีที่แล้ว +8

    You're so helpful. I am learning at 11 and you teach so well.

  • @atexxxxx
    @atexxxxx 3 ปีที่แล้ว

    This guy is really good!!!! Wow... It actually makes sense

  • @tanushreerao8177
    @tanushreerao8177 4 ปีที่แล้ว +1

    Thanks for clearnig the concept thank u so much😁😁

  • @selinjodhani2634
    @selinjodhani2634 4 ปีที่แล้ว +9

    from math import sqrt
    for i in range(1,501):
    if(i%(sqrt(i))==0):
    print(i)

  • @riserich
    @riserich 5 ปีที่แล้ว +3

    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

  • @ganeshmane
    @ganeshmane 4 ปีที่แล้ว

    Thank you very much , good bless you always

  • @Ajay-ug6do
    @Ajay-ug6do 3 ปีที่แล้ว

    THAT 'S WAS WONDERFUL IT WAS VERY EASY TO UNDERSTAND THIS CONCEPT

  • @ZinduZatism
    @ZinduZatism 6 ปีที่แล้ว +22

    cannot wait for pattern teach us diamond and circle pls a d all shapes also pls teach us merge sort thank u

  • @mrjh8467
    @mrjh8467 4 ปีที่แล้ว +5

    Another excellent explanation. Highly encourage people who are studying python at college to definitely add these videos to supplement their learning.

  • @blinkoverhere4649
    @blinkoverhere4649 ปีที่แล้ว

    Your video really helped me thank you! I think you explain it well.

  • @06_shubhambirhade81
    @06_shubhambirhade81 3 ปีที่แล้ว

    well explained sir... Thanks for such amazing videos.

  • @omsaichand9798
    @omsaichand9798 5 ปีที่แล้ว +4

    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

  • @Simsom
    @Simsom 5 ปีที่แล้ว +4

    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)

  • @eventhorizon69
    @eventhorizon69 ปีที่แล้ว +1

    you explained it better than my schoolteacher. THANKYOU

  • @mohammedazmathulla6474
    @mohammedazmathulla6474 2 ปีที่แล้ว

    I am really enjoying it 😊the way "Navin" explains

  • @hungamamachao7808
    @hungamamachao7808 5 ปีที่แล้ว +4

    for i in range(1,501):
    y=i*i
    if y

  • @chagaletiramamohanreddy332
    @chagaletiramamohanreddy332 ปีที่แล้ว +5

    for i in range(1,100):
    j = i * i
    if j

  • @syedalihasantaqialijaffry7883
    @syedalihasantaqialijaffry7883 5 ปีที่แล้ว +1

    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

  • @adishct4371
    @adishct4371 ปีที่แล้ว

    your explanation is very good sir, i have suggest your playlists to my other friends whose are learning websites.

  • @ishanthmishra7658
    @ishanthmishra7658 4 ปีที่แล้ว +6

    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 3 ปีที่แล้ว +1

      find perfect square not square of number bro

  • @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

  • @actingstarchethan
    @actingstarchethan 3 ปีที่แล้ว

    U made it much easier.... Lots of love from Karnataka

  • @SuRaj-ho9dq
    @SuRaj-ho9dq 4 ปีที่แล้ว +8

    Import math
    for i in range(500):
    If math.sqrt(i)%1==0:
    Print(i)

  • @agirlfrom_mountains
    @agirlfrom_mountains 4 ปีที่แล้ว +6

    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.

  • @Sindhimanhu143
    @Sindhimanhu143 5 หลายเดือนก่อน +1

    Being a pakistani and urdu speaker the way of your teaching is very easy thanks sir enjoying your tutorial

  • @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😀😀

  • @mathandsciencebestonlinele5260
    @mathandsciencebestonlinele5260 4 ปีที่แล้ว +5

    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 ปีที่แล้ว +1

      After using this code the ouput coming is :- 1

  • @harshabasavaraju4609
    @harshabasavaraju4609 4 ปีที่แล้ว +3

    for I in range (1,501):
    s=I*I
    If I

  • @sergioisaacpuentesto
    @sergioisaacpuentesto 4 ปีที่แล้ว

    You are very good explaining! Love you bro

  • @nyquistnwaukwa6220
    @nyquistnwaukwa6220 4 ปีที่แล้ว

    Thanks a lot Sir!
    Really helped

  • @milanbariya4914
    @milanbariya4914 4 ปีที่แล้ว +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 ปีที่แล้ว +3

    for i in range(1, 501) :
    if(i*i

  • @SantoshSahu-nd1bw
    @SantoshSahu-nd1bw 5 ปีที่แล้ว

    for i in range(1,501):
    j=1
    while(j*j

  • @nitinduke
    @nitinduke 5 ปีที่แล้ว

    amazing explanation well polished..better than udacity and other

  • @harshvora1922
    @harshvora1922 5 ปีที่แล้ว +4

    Perfect squares between 1 and 500:
    x = range(1, 501)
    for i in x:
    print(i * i)

  • @riyabhatnagar6220
    @riyabhatnagar6220 3 ปีที่แล้ว +1

    finally i knw this for loop thnk u