#21 Python Tutorial for Beginners | For Loop in Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ม.ค. 2025

ความคิดเห็น • 1.3K

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

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

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

      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 ✌️

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

      beautiful and simple... one problem, I think range should be (1, 501)

  • @ashitshekhar847
    @ashitshekhar847 4 ปีที่แล้ว +207

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

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

    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.

  • @aswasshsutar5367
    @aswasshsutar5367 4 ปีที่แล้ว +32

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

  • @blackheart450-u4v
    @blackheart450-u4v 3 ปีที่แล้ว +28

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

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

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

    i=1
    while i

  • @sayanth.p3625
    @sayanth.p3625 5 หลายเดือนก่อน +47

    Anyone in 2024?🙂

    • @karthikhasri9264
      @karthikhasri9264 3 หลายเดือนก่อน

      Yehh

    • @firexex
      @firexex 2 หลายเดือนก่อน +2

      its 6 years old but more updated than indian education syllabus 😂

    • @slokshaw959
      @slokshaw959 หลายเดือนก่อน

      Yeah

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

      Yeah. Need free python complete course pls

  • @vainayak30
    @vainayak30 6 ปีที่แล้ว +229

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

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

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

      Why did u print that fourth command ; if int( root + 0.5)**2==i .
      Why is that 0.5 needed ?

  • @jayakumarpurushothama6473
    @jayakumarpurushothama6473 6 ปีที่แล้ว +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 5 ปีที่แล้ว +5

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

    • @bindassboss4842
      @bindassboss4842 5 ปีที่แล้ว +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?

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

    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.

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

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

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

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

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

  • @badrit5153
    @badrit5153 6 ปีที่แล้ว +84

    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

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

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

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

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

  • @MrObadebella
    @MrObadebella 5 หลายเดือนก่อน +3

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

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

    for i in range(1,501):
    if i!=0:
    print(i**2)
    else:
    print(i)
    Hey Buddy Its gr8 learning from U U are SUPERB!!

  • @poorna685
    @poorna685 4 ปีที่แล้ว +24

    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

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

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

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

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

    i = 1
    while i**2

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

      Nice

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

      very easy ...the same 4rm the lesson...thanks sparta...

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

      Not working

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

      you didnt use the for looooooooop!

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

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

    for i in range(500):
    r=pow(i,2)
    if r

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

    import math
    for i in range(1,500):
    perfect_square = pow(i,2)
    if perfect_square

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

      Thanks for putting the solution in the comments 😅

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

    This is my first answer sir,
    num=1
    for i in range(num,500):
    sqrt=num*num
    if sqrt

  • @akankshakumari6327
    @akankshakumari6327 20 วันที่ผ่านมา

    Sir your explanation is crystal clear which reflects your great knowledge about these things and moreover your interest pertaining to world of programmings. It's wonderful to learn from you.🎉🎉🎉🎉🎉🎉🎉

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

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

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

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

    u r great sir ur way of teaching is just incredible

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

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

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

      for i in range (1 ,23):
      print ("i**2)
      i think this is simpler

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

      @@aryaveergupta4269 Ofcourse 👍🏻👍🏻 , that was me one year ago 😅.

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

    Took time but finally got it :)
    Heres my code-
    import math
    for i in range(1,501):
    a=math.sqrt(i)
    if a/math.floor(a)==1:
    print(i)

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

      Can you please explain that a/

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

      @@chandanmishra5934 The loop goes frm 1 to 500
      A is square root of the number
      If the number is divided by the floor of that number(floor means converting the decimal value to integer value
      For ex: 2.6 is converted to 2)
      Then it's a perfect square

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

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

    sir the way you are teaching is awesome

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

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

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

      for i in range(1,501):
      print(i*i)
      try this one your code is not giving the square of last (500)

  • @sumanshu.nankana
    @sumanshu.nankana 5 ปีที่แล้ว

    for i in range(1,501):
    s = pow(i,2)
    if s < 501:
    print(s)

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

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

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

    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)

  • @Pinkberry381
    @Pinkberry381 4 ปีที่แล้ว +12

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

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

    for i in range(1,50):
    b=i*I
    if b

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

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

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

    the general solution :
    import math
    x= int(input("enter any positive no." ))
    for i in range (1,x+1,1):
    if math.floor(math.sqrt(i))==math.ceil(math.sqrt(i)):
    print(i)

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

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

      asli dakait boltee

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

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

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

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

      @@vaibhavbopte9970 what is import math? Is it the same to c lang lib math.h?

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

      @@kohlbovee7592 can u please explain me the functioning of if line clearly? I am a bit confused 😕

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

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

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

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

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

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

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

    Holy shit dude youve just cleared up so many things in this video def subbing.

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

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

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

    from math import sqrt
    for n in range(1, int(sqrt(500))+1):
    print(n * n)

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

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

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

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

  • @akshatuniyal6033
    @akshatuniyal6033 หลายเดือนก่อน

    Very Well explained, I am laying my hands on programming and i find it very interesting and better than any classroom lecture though i am a math expert, i can easily understand.

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

    import math
    i=1
    while i

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

    My Code for Quiz Question :
    x=range(23)
    for i in x:
    if(i*i0):
    print(i*i)
    THANK U NAVIN SIR

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

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

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

    you explained it better than my schoolteacher. THANKYOU

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

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

    Best...The best... way to learn coding is by watching ur vdo.

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

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

  • @DevSharma-eg3sx
    @DevSharma-eg3sx 3 ปีที่แล้ว

    thank you sir,
    ans>>> for a in range(1,26):
    if a**2>=500:
    continue
    print(a**2)

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

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

    • @varsinisivabalu9245
      @varsinisivabalu9245 6 ปีที่แล้ว

      Why we are printing i**2??? Pls explain it..

    • @manojs6647
      @manojs6647 6 ปีที่แล้ว

      ** indicates power of , start from initial vedios

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

      We dont need 'import math' here

    • @RohitSingh-zo8ci
      @RohitSingh-zo8ci 6 ปีที่แล้ว

      It is wrong see the question b/w 500 not 501

    • @sreemanbadugu9781
      @sreemanbadugu9781 6 ปีที่แล้ว

      @@varsinisivabalu9245 it means ** power so we are squaring it

  • @aleezaali-v2r
    @aleezaali-v2r ปีที่แล้ว +1

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

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

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

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

    from math import pow,sqrt
    for i in range(1,30,1):
    i = pow(i,2)
    if i >= 1 and i

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

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

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

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

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

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

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

    import math
    for i in range(1,501):
    sqr=math.sqrt(i)
    res=sqr-int(sqr)
    if res==0:
    print (i,"=",sqr)

  • @nidhigoswami2526
    @nidhigoswami2526 5 ปีที่แล้ว +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.

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

    This also works and you don't have to import math :)
    for i in range(1,501,1):
    j= i**0.5
    if j==int(j):
    print(i)

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

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

    import math
    for i in range(1,51):
    x=math.pow(i,2)
    print(i)

  • @GurpreetSingh-td4es
    @GurpreetSingh-td4es 4 ปีที่แล้ว +5

    for i in range(1,50):
    if(i*i==i*i):
    print(i*i)

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

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

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

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

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

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

    Viewing at 0.75x

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

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

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

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

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

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

  • @agirlfrom_mountains
    @agirlfrom_mountains 5 ปีที่แล้ว +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.

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

    from math import sqrt, ceil
    for i in range(1,ceil(sqrt(501)),1):
    print("square of : ", i, "is", i*i)

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

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

  • @Simsom
    @Simsom 6 ปีที่แล้ว +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)

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

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

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

      find perfect square not square of number bro

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

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

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

    # printing all perfect square numbers between 1 and 500
    i=1
    for i in range (1,30,1):
    if i*i

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

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

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

    for i in range(1,500):
    if i*i>=500:
    break
    print ("Square num ",i*i)

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

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

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

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

  • @LightYagami-pw4wu
    @LightYagami-pw4wu 5 หลายเดือนก่อน +5

    Anyone here in 2024 july or thereafter ?