Python Programs - Factorial Program Using for loop

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

Комментарии • 224

  • @algo3an
    @algo3an 4 года назад +49

    finally, someone explains it in details. I struggled a lot trying to understand it. Keep up the good work

    • @AmulsAcademy
      @AmulsAcademy  4 года назад +3

      Thank you :)

    • @Ayasir-lo3ir
      @Ayasir-lo3ir 4 года назад +3

      it's simple it goes back to for loop when the there is no more list it will return the list

    • @supriyasuppu8388
      @supriyasuppu8388 3 года назад +1

      Hlo explain how find given number s factorial or not
      Example 24=4!

    • @YDM16
      @YDM16 2 года назад

      Same here💯💯

    • @sunitagupta5864
      @sunitagupta5864 2 года назад +1

      Hh

  • @garammasala9886
    @garammasala9886 3 года назад +13

    I was trying to understand from previous two days to understand in detail, finally my search is over and got a perfect explanation. Big THANK YOU : )

  • @AdamGiaIsMetal
    @AdamGiaIsMetal 4 года назад +7

    You are THE best python teacher on YT. Thanks from New York!

  • @srishtinisha1712
    @srishtinisha1712 Год назад

    I came here after watching so many videos which goes over my head.. finally the way you explain in detail clear my concept.. thank you so much 🙏

  • @libinvarghese2886
    @libinvarghese2886 2 года назад +2

    Thank you ma'am.. this explanation is truly a gem. I was trying to learn this for a week.

  • @chidij20
    @chidij20 Год назад

    You are definitely a good teacher 👏🏽👏🏽👏🏽👏🏽I need more classes so I had to follow you

  • @chennaramana9893
    @chennaramana9893 6 лет назад +5

    I don't know your age but the way you teaching was with full of clarity and even non IT can also learn this python through your teaching but my request make some videos about complex programs of using combinations of if, for , while and also tkinter kindly

  • @omkar1592
    @omkar1592 3 года назад +4

    Thanks Amulya for this amazing explanation!!!

  • @francescowang
    @francescowang 3 года назад +1

    n = 5
    result= 1
    for i in range(n, 0, -1):
    result *= i
    print('the factorial of', n, 'is', result)
    alternative method:
    n = 5
    result= 1
    for i in range(1, n + 1):
    result *= i
    print('the factorial of', n, 'is', result)
    Why does (n, 0, -1) work the way it does? I find (1, n + 1) slightly easier to understand. It begins at 1, then to stop the loop you do n+1.
    Fantastic video btw. Please keep making them. You are brilliant. I just subscribed.

    • @AmulsAcademy
      @AmulsAcademy  3 года назад

      range(n,0,-1) will give output 5 4 3 2 1 😊

    • @iamchaos9144
      @iamchaos9144 3 года назад

      @@AmulsAcademy how can I print for example 1×2×3×4=24

  • @krishk4870
    @krishk4870 5 лет назад +5

    Neat Yar amul baby😊😘 loved it

  • @JS-nv6dd
    @JS-nv6dd 5 лет назад +2

    Explanation is depth enough.Sooo Good😃

  • @sathya_krish
    @sathya_krish 4 года назад +3

    Thank you So Much😄 You have Great Teaching Skill😇

  • @vishal_sharma_2006
    @vishal_sharma_2006 3 года назад +2

    Amulya u are on the next level girl u explain so easily . Keep growing

  • @paviyug
    @paviyug 4 года назад +3

    Your explanation is very clear. Thank you so much

  • @asfarhatehanoor2163
    @asfarhatehanoor2163 2 года назад

    Thank you very much madam🙏🙏🙏your way of explanation is very nice....
    .madam

  • @Krishhh.....
    @Krishhh..... 3 года назад +1

    You at the best python teacher

  • @codershakil6393
    @codershakil6393 4 года назад +4

    Really Helpful.Thanks A lot.I had confusion about factorial program but from this video I completed my clearance .
    while True :
    print("I loves Amulya's Academy ")
    Happy Coding ;)

  • @mamatharani-xd6zp
    @mamatharani-xd6zp Год назад

    Thank you so much and Lots of gratitude for your way of explanation

  • @dineshkumar-bi7my
    @dineshkumar-bi7my 3 года назад +3

    Awesome, Thank you. Now my doubt was cleared after saw your video :)

  • @prakhyathmunna254
    @prakhyathmunna254 3 месяца назад +1

    Simple and effective explanation mam ❤

  • @nurfatinnazurah296
    @nurfatinnazurah296 3 года назад +2

    Thanks, i was just struggle answering my question and after i found this, i'm now ok with it.

  • @greeshmashetty1724
    @greeshmashetty1724 4 года назад +9

    Amulya a kind request - can you also please start making videos for javascript programme along with python. Javascript is also widely used and I am sure lot of people out there are looking for programming way of explaining just like you do in python. I will be so greatful for you if you can start javascript tutorial and programs as well. Thank you very much. ❤️

  • @ashleyjones193
    @ashleyjones193 2 года назад

    Excellent explanation this question asked in capgemini interview

  • @pakwebandgraphics8992
    @pakwebandgraphics8992 4 года назад +1

    great the way you teach is very good and every thing is clear

  • @kumkumslab5811
    @kumkumslab5811 4 года назад +2

    Nice explaination mam after a long time i got your channel

  • @mokimanik8721
    @mokimanik8721 Год назад

    Wonderful teaching ✨🙏 but I saw one of the they mentioned num+1 in range like
    num=7
    f=1
    For i in range(1, num+1):
    f=f*1
    Print (f)

  • @vfx7t
    @vfx7t 3 года назад +1

    thank you from Algeria ! good job :)

  • @ranjanrana8227
    @ranjanrana8227 3 года назад

    Thanks a lot maam…….. I finally understood the full logic

  • @vishaltiwaribnt
    @vishaltiwaribnt 2 года назад

    step by step clearly explain.....thnks u

  • @vishallodhi5416
    @vishallodhi5416 4 года назад +2

    You are doing great job

  • @AslamAslam-bh7sy
    @AslamAslam-bh7sy Год назад

    Very good explain,, thank u so much,.. ❤

  • @maheshkumarinfo9806
    @maheshkumarinfo9806 2 года назад

    Tq for your beautiful explanation❤

  • @infinity4037
    @infinity4037 3 года назад

    Your explanation is awesome.

  • @agamsaraswat5296
    @agamsaraswat5296 2 года назад

    explanations of the exact happenings in for loop helped us understand this function

  • @sumitjha3033
    @sumitjha3033 3 года назад +1

    thank you you explained it in the best way

  • @its_vivek_mahur
    @its_vivek_mahur 5 лет назад +1

    your voice very good and anle to understand

  • @manasibhoir3988
    @manasibhoir3988 4 года назад +1

    Very good explanation 👍👌

  • @ANTDOG123
    @ANTDOG123 5 лет назад +5

    Thank you so much for your help and knowledge on the subject. I was really struggling.

  • @manikandand2541
    @manikandand2541 4 года назад +2

    hiii mam i am came again shall i say one thing....every program...in python...i will search like.....the program name with amul acedemy in youtube search....lv u mam...u r like mentor

  • @ansarchakkala4326
    @ansarchakkala4326 Год назад

    Nice vedio and explanation was very clear

  • @nagendra9853
    @nagendra9853 3 года назад

    Really awesome explained it's easy to understand please upload full python tutorial pin to pin explain 🤗

  • @ilzz9856
    @ilzz9856 4 года назад +1

    Like ur teaching 🔥🔥🔥

  • @mohamedhasan5259
    @mohamedhasan5259 4 года назад +1

    finally i have got my computer science tutor

  • @enough_4_you680
    @enough_4_you680 3 года назад +1

    Thnkuuuuu sooo much....... 🐨🐨

  • @sudiptachakraborty745
    @sudiptachakraborty745 6 лет назад +2

    You are doing a fantastic job. Keep it up.

  • @DeepakKumar-xu6kg
    @DeepakKumar-xu6kg 4 года назад +1

    Really, very helpful channel and the explanation and content is awesome....😊👍

  • @sabyasachidas4572
    @sabyasachidas4572 2 года назад

    I've just learned the basics of python and im solving some basic questions. Can you tell me shall start learning dsa or I should wait and solve more python problems to start it🤔
    Please reply it will be very helpful to me.

  • @muhammedilliyas7261
    @muhammedilliyas7261 4 года назад +1

    Really you are a great teacher/trainer. thank you so much. if you conducting a learning institution please let me know.

  • @ambreshmeti8025
    @ambreshmeti8025 2 года назад +1

    Super explanation kya kaa

  • @dhineshdhini8416
    @dhineshdhini8416 6 лет назад +1

    1st thank u for ur video its simple nd easy to understand
    can you make a factorial program using while loop

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад +4

      This may help you:
      num = int(input("enter the number: "))
      res = 1
      i = 1
      while i

  • @umarhasnain7369
    @umarhasnain7369 4 года назад +1

    Great explanations. I was looking for it

  • @abishaa6691
    @abishaa6691 3 года назад

    Good work..

  • @vidhijaiswal5605
    @vidhijaiswal5605 3 года назад +1

    Thank you for your help

  • @MRPJ-ty3ps
    @MRPJ-ty3ps 4 года назад +1

    thank you so much u saved me i was unable to understand this program

  • @Selvi574
    @Selvi574 5 лет назад +1

    Very helpful mam

  • @ishaan3475
    @ishaan3475 2 года назад

    Thank you so much🙏

  • @sprangyabehera4227
    @sprangyabehera4227 5 лет назад +1

    awesome tutorial

  • @jaianand2497
    @jaianand2497 6 лет назад +1

    Thank u mam for such a nice video but can u plz do this factorial problem using while lopp

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад +1

      Thank you:)
      using while loop:
      num = int(input("enter the positive integer:"))
      result = 1
      i=1
      while i

    • @jaianand2497
      @jaianand2497 6 лет назад

      @@AmulsAcademy thank you mam😊

  • @jacobmathews862
    @jacobmathews862 5 лет назад +1

    Mam can do Qns like write a menu driven program to print truth table of following logic gates AND,OR,NOT

  • @Viknesh2411
    @Viknesh2411 4 года назад +1

    Thank you 🙏

  • @eshwarb1115
    @eshwarb1115 3 года назад

    I'm getting 1as output for factorial of 5
    what to do

  • @sohailkazi5901
    @sohailkazi5901 5 лет назад +3

    Thank you!

  • @THUSxFAR
    @THUSxFAR 4 года назад +1

    Great video

  • @mominakhoon7171
    @mominakhoon7171 2 года назад

    why do we write (-1) in the range?

  • @smehta2668
    @smehta2668 9 месяцев назад

    i'm confusing from last one year i have completed my data science course but programming concept is not clear yet. Now my searching is over i'll not miss any videos please upload some more videos for python.

  • @nevaehortiz8210
    @nevaehortiz8210 2 года назад

    Hey, I love the video and I now understand it better but do you know how to make it so it only gives a factorial of numbers in a set range?? I need it to be between 1 and 25 but I don't know how to get the range set without it running through every single number, thank you for any help :] have a good day

  • @raravindh8808
    @raravindh8808 2 года назад +1

    Thank you mam

  • @soumyasinha4183
    @soumyasinha4183 4 года назад +1

    Here we can take range as (1,n+1)?

  • @rafaqathussain7259
    @rafaqathussain7259 5 лет назад +1

    good explanation

  • @neelampandey1718
    @neelampandey1718 5 лет назад +1

    3:45 y take stop arg. as 0......it works till " stop-1" so taking it 0 doesn't mean the loop will run till 0-1= -1 ?!?!

    • @AmulsAcademy
      @AmulsAcademy  5 лет назад +1

      No it will works till 1.
      we took step as -1 so values will be in the reverse order.
      if n=5
      then range(n,0,-1)
      means range(5,0,-1) = 5 4 3 2 1
      0 is excluded.
      :)

  • @venkataramanabanda8105
    @venkataramanabanda8105 3 года назад +1

    If take n = 0 then what will happens..how works plz tell me...0*1=0

  • @dfgndfghdfghdfgh
    @dfgndfghdfghdfgh 4 года назад +1

    so helpful

  • @abishaa6691
    @abishaa6691 3 года назад

    understandable 👌

  • @ramakantpandit7151
    @ramakantpandit7151 2 года назад

    The helps me alot

  • @sivasuriya6016
    @sivasuriya6016 5 лет назад +3

    your voice is really good

  • @aj0035
    @aj0035 4 года назад +1

    Thank You Honestly ❤

  • @rajathilaks
    @rajathilaks 4 года назад +2

    Hello Amulya,
    I have doubt,
    num=0
    result=1
    if i in range(num,0,-1): #(0,0,-1)#i=0
    result=result*i #1=1*0=0
    print (result) #ans=0#how it get output 1
    Can you clarify me above concept for given input as 0
    Thanks in advance

    • @AmulsAcademy
      @AmulsAcademy  4 года назад +1

      if i in range(num,0,-1): #(0,0,-1)#i=0
      I think it is not if , you are using for loop.
      and when range() starts from 0 and ends 0 it won't take i as 0, actually it won't give any value because end value is exclusive.
      So it won't execute for loop body.
      it will print the result, that's why you will get result as 1.
      if you want result as 1 then you can write like this:
      for i in range(num,-1,-1): #(0,-1,-1)#i=0

    • @rajathilaks
      @rajathilaks 4 года назад

      @@AmulsAcademy Thank you :)

  • @haarishp4913
    @haarishp4913 4 года назад +1

    Your voice is nice

  • @radhakrishna.kalluri7192
    @radhakrishna.kalluri7192 2 года назад

    The Best

  • @nagaratnacp1718
    @nagaratnacp1718 4 года назад +1

    Instead of using (n,0,-1)..we can use (1,n+1) ryt mam?

    • @AmulsAcademy
      @AmulsAcademy  4 года назад +1

      In range function when we use range(n,0,-1) means start is n end is 0.
      for example if n=5 range(5,0,-1) = 5,4,3,2,1
      But range(1,n+1) is different. Here start is 1 and end is n+1.
      for example n=5 range(1,6) = 1,2,3,4,5

  • @asiachannel2826
    @asiachannel2826 4 года назад

    Really mam your voice is very beautiful like cackoo

  • @anuragmu2925
    @anuragmu2925 10 месяцев назад

    And when we have to print like 5×4×3×2×1=120 what we have to do

  • @s2613
    @s2613 6 лет назад +1

    Why did you take result=1 ?
    Could please tell me Amulya

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад +1

      Because to get factorial of number we need to do multiplication.
      result is the variable which will hold my final result.
      If i take 0 , 0 multiply anything will be 0, that's why i took 1.
      value 1 won't change any output, because if you multiply any value with 1 answer remains same
      :)

    • @s2613
      @s2613 6 лет назад +2

      Amuls Academy Thank you so much Amulya 😊
      You are really doing great job 😊

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад

      Thank you :)

  • @antonyjerusal4890
    @antonyjerusal4890 3 года назад

    thanks a lot

  • @gajjadatinku5700
    @gajjadatinku5700 3 года назад

    Why zero is taken range function, in this program, how it is used.

  • @krishnakantmishra9168
    @krishnakantmishra9168 4 года назад +3

    Ma'am in my PC it shows errror in the 2nd line

    • @algo3an
      @algo3an 4 года назад

      Double check your indentation. It could be the issue. Plus what error message are you getting?

  • @yaya9164d
    @yaya9164d Год назад

    thank you

  • @santhoshking2590
    @santhoshking2590 3 года назад +2

    Your voice is...beautiful... 😅

  • @lakshmansai4172
    @lakshmansai4172 4 года назад

    Madam why we used the -1 in for loop

  • @komaljaswani7497
    @komaljaswani7497 5 лет назад

    Hi! Can you please make a video on the question: If a list in python has mix of strings & numbers, how will you make separate lists of strings & numbers? I saw ord() for getting ASCII code in python & chr() for converting ASCII codes to characters somewhere & tried to use them to get answer of this question but it did not work!! :(

  • @shafeeqahmed7019
    @shafeeqahmed7019 4 месяца назад

    Mam what if n=0 in this case?

  • @Vithal_Nivargi
    @Vithal_Nivargi 3 года назад

    thank u mam

  • @balakrishnavaidyanathan8572
    @balakrishnavaidyanathan8572 4 года назад

    Your python mergesort shellsort are very to learn

  • @santoshvishwakarma3193
    @santoshvishwakarma3193 6 лет назад +1

    Thanks

  • @manikandand2541
    @manikandand2541 4 года назад +1

    thank u

  • @prabhashthakur2702
    @prabhashthakur2702 7 лет назад +1

    great didi

  • @AarthifTechBuild
    @AarthifTechBuild 6 лет назад +1

    Pls pls pls do a video on GCD IN PYTHON

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад

      sure:)

    • @AarthifTechBuild
      @AarthifTechBuild 6 лет назад +1

      Amuls Academy
      When will you do it

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад

      Maybe in next week:)

    • @AarthifTechBuild
      @AarthifTechBuild 6 лет назад +1

      Amuls Academy
      Ok cool

    • @debanshukumar580
      @debanshukumar580 6 лет назад

      😙😙 DIDI your way of " explanation" and "voice " is very sweet and awesome.......
      🙋 KEEP IT UP......THANKS FOR UPLOADING SUCH GREAT VIDEOS.....
      WANT YOUR HELP...........

  • @sojibakash
    @sojibakash 3 года назад

    If we provide input=0,, result=1*0,, so it print output 0., but 0 factorial =1..how it??

  • @aniljain5094
    @aniljain5094 5 лет назад

    Can u make this program using while loop.

    • @JonnyGall
      @JonnyGall 4 года назад

      n = int(input("Enter the number: "))
      result = 1
      while i > 0:
      result = result * i
      i = i - 1
      print("Factorial of",n,"is",result)

  • @sonamnaik2804
    @sonamnaik2804 5 лет назад +1

    tysm....♥️