#26 Python Tutorial for Beginners | Array in Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 พ.ย. 2024

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

  • @abhishekbajpai9920
    @abhishekbajpai9920 6 ปีที่แล้ว +481

    It took just 3-4 days for understanding basic syntax of python without holding other works because of your videos. These are to the point videos. Each minute has valid content. Thanks to You Mr. Naveen. Our colleges need teachers like you.

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

      That's right

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

      Bro I truly agree

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

      that's call comment

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

      It took me 3-4 days to understand what he is saying.

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

      Visual information is the best way of learning something

  • @Luka-se7sl
    @Luka-se7sl 4 ปีที่แล้ว +605

    wtf? Almost everytime when i try to guess new things and searching, always this man is on first page with best tutorials. Thank you man))

    • @avnishbadoni1393
      @avnishbadoni1393 4 ปีที่แล้ว +20

      One reason being, Google/TH-cam filters content according to your preferences. 😄

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

      Oh i got to know array in Python is new thing!!

    • @anonymous-w6y
      @anonymous-w6y 8 หลายเดือนก่อน +2

      this generation kids use bad words fluently without hesitation bruh
      ~wise kid

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

      ​@@anonymous-w6y+1 For U😂❤

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

    India needs more teacher like u....we pay laks of fees to clg and learns nothing .

  • @ashu__risiofficial5887
    @ashu__risiofficial5887 4 ปีที่แล้ว +82

    I was "Zero" in any programming, Now all my daily jobs is running with python, Because of Mr Naveen Reddy. Thank you sir, The way you teach is nothing but a solution you provide.

  • @srivathsanm745
    @srivathsanm745 4 ปีที่แล้ว +29

    MAN, you're amazing teacher and I could learn this much python in 3 days and its because of you. I like your slang and also the teaching methods. Even after 2 yrs, yours is awesome one during search of course in youtube. Done well congrats :D

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

    I possess a full Udemy course regarding Python3 and I'm quite good in python after finishing 70% of the course.. But I think it could have been better if I took Python3 knowledge from your lectures...
    Kudos to you reddy ji!!!
    ❤️❤️

  • @somok1000
    @somok1000 4 ปีที่แล้ว +7

    Started following your videos on Python. Your way of explanation is amazing. Our country needs teacher like you :)

  • @puneetdhangwal84
    @puneetdhangwal84 4 ปีที่แล้ว +47

    To find factor of a given number:
    Import math as m
    a = int(input("Enter your number: "))
    print(m.factorial(a))

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

      that helps thank you :)

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

      @@NikSy 'import' ( lowercase i ) :-)

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

      How did u get this??

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

      bhai galat hh factorial ki value sidha dega yeh printing me
      x=int(input("enter any value"))
      fact=1
      for i in range(1,x):
      fact=fact*i
      print(fact)
      yeh shii solution hhh

  • @Perplexedsouvik
    @Perplexedsouvik 4 ปีที่แล้ว +14

    Great learning experience. Thanks a lot sir. Atleast a guy like me who didn't had any interest in computers , started watching and practicing Python .

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

    I'm learning python almost 1month but I have no much knowledge about array or others.. But when I start watching your tutorial, I have got much knowledge and improve myself.
    Thanks sir..

  • @Anishbhosle14
    @Anishbhosle14 4 ปีที่แล้ว +19

    i wish i had professors or HOD like him engineering would have been heaven

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

    qn1.
    from array import *
    vals = array('i',[2,8,1,9,12])
    for i in sorted(vals):
    print(i)
    qn2.
    from math import *
    num = int(input('kindly enter your number'))
    print(math.factorial(num))

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

    num = 1
    x = int(input("Enter the Number:\t"))
    for i in range(1, x+1):
    num = i * num
    print(num)

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

    1) from array import *
    vals=array('i',[1,50,8,25,91,22])
    vals=sorted(vals)
    print(vals)

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

      Why we haven't be use sorted like
      vals.sorted()
      But we use reverse
      vals.reverse() like this???

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

      @@priyanshupatel02 same doubt,,,,,I think it is based on somthing like return function,,,,If u got the answer,,then plz let me know too!!

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

      @@crosswalker45 Reverse method parameter ni leta
      And sorted takes parameter..
      That's why sorted(list) will work...and for working reverse, you need to directly call this with list..without any parameter..like List.reverse()
      This sending me one who doing programming

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

    #ArraySorting
    from array import array
    x = array('I',[0,10,7,2,63,19])
    print(sorted(x))

    • @dhruvdutt2749
      @dhruvdutt2749 4 ปีที่แล้ว +10

      import array
      a=array.array('i', [23,22,56,97,-68])
      b=sorted(a)
      for i in b:
      print(i)
      It would be better in case you want integers individually

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

      @@dhruvdutt2749 Why arrray.array, array( , ) is sufficient na?

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

      @@harikpriyatirumalaraju674 not in my situation

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

      Dhruv Dutt why?

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

      @@harikpriyatirumalaraju674 because i used import array instead of From array import Array/ From array import *

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

    print("Factorial finding machine")
    user= int(input("Please enter you number"))
    a=1
    b=1
    for i in range(1,user+1):
    if i

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

    Second answer
    number=int(input(type number))
    factorial=1
    for I in range(1,number+1):
    factorial=factorial*i
    print(factorial)

  • @abdullahstutorial5319
    @abdullahstutorial5319 4 ปีที่แล้ว +16

    answer of 2nd question is
    import math
    a = int(input("Enter your number: "))
    print(math.factorial(a))

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

      bhai galat hh isme direct value print kr dega

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

      x=int(input("enter any value"))
      fact=1
      for i in range(1,x):
      fact=fact*i
      print(fact)

  • @ale94ge
    @ale94ge 4 ปีที่แล้ว +11

    1)
    from array import *
    valori = array('i',[2,4,8,7,3,42,109,10000,100908])
    while True:
    print(sorted(valori))
    break
    2)
    from math import*
    x=int(input("Qual è il fattoriale di questo numero?"))
    while True:
    print(factorial(x))
    break

  • @cadurgesh
    @cadurgesh 4 ปีที่แล้ว +13

    hello sir
    a simple request from side.
    could you please write assignment questions in description instead of showing them in end of video.
    If you do it for making suspense then it is okay but please show them in left bottom side instead of showing them on top because at the end of the video telusko logo comes and questions got invisible.
    So please consider this request.
    Thank You.. you are doing great!!

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

    Thank Q sir,We are paying fee in colleges but it does'nt give the practical Knowledge,but your are giving your best.Keep doing videos and inspire many

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

    from array inport*
    vals=array('i,[1,2,3,4])
    i=0
    while i

    • @Manishsingh-uw5mo
      @Manishsingh-uw5mo 3 ปีที่แล้ว

      It just prints 1 infinitely bro and there are typo mistakes .

  • @CultOfJ
    @CultOfJ 4 ปีที่แล้ว +19

    Factorial Algorithm created by me without using any prebuild function:
    print ( "Enter a Number to find its factorial: " , end="" )
    inp = int ( input( ) )
    ans = 1
    for x in range ( inp ) :
    ans = ans * ( x + 1 )
    print ( "Factor of" ,inp, "is:" ,ans )

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

    ## Sort array using selection sort ###
    import array as arr
    """ selection sort """
    val = arr.array('i',[4, 5,-5,-12, 6, 7, -8])
    print("before sort:",val)
    for a in range(len(val)-1):
    for b in range(a+1,len(val)):
    if val[a] > val[b]:
    val[a],val[b] = val[b],val[a]
    print("
    after sort:",val)

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

      from array import *
      val = array('i',[21,15,43,-66,100])
      print("sorted array = ", sorted(val))

  • @sumanthkumar4035
    @sumanthkumar4035 4 ปีที่แล้ว +127

    "welcome back aliens" never thought I would enjoy this sentence

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

      But we r humans 🦍🦍🦍

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

      @@stockfish3379 are we?

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

      @@stockfish3379 we are aliens wrt the aliens

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

      Perfect said

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

      @tcfreestyler123x what is that

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

    The way you teach is really awesome, not making any confusion, sometimes we really want to have some doubt to ask but you are making it a bit difficult to have doubt☺️☺️

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

    For factorial of a number
    x=int(input('Please enter your number'))
    j=i=1
    while i

  • @NaveenKumar-or1jd
    @NaveenKumar-or1jd 2 ปีที่แล้ว +3

    #1-sorting
    from array import *
    arr=array('i',[11,7,9,6,-4,3,5])
    for i in range(len(arr)):
    for j in range(i+1,len(arr)):
    if(arr[i]>arr[j]):
    arr[i],arr[j]=arr[j],arr[i]
    print(arr)
    #2-factorial
    number=int(input("Enter a number:"))
    value=1
    for i in range(1,number+1):
    value=value*i
    print(f"factoiral of {number} is",value)

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

      instead of using value = value * i you can use value *= i to make it simpler

  • @MuhammadBilal-xq1dw
    @MuhammadBilal-xq1dw 2 ปีที่แล้ว

    Telusko is the Best Channel on the Earth to Learn Programming! Hats Off... Dear Navin!

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

    from array import *
    values = array("i", [7,4,9,2,6,2,1])
    x=len(values)
    for i in range(x):
    for j in range(i+1, x):
    if values[i]>values[j]:
    temp = values[i]
    values[i]=values[j]
    values[j]=temp
    print(values)

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

      for swap u csn use a[i],a[j]=a[j],a[i]

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

      Here you use selection sort algorithm am I correct?

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

    For solution of 1 :
    #To sort an array in ascending order
    from array import *
    vals = array('i', [1, 3, 8, 9, 2])
    for i in range(len(vals)):
    for j in range(len(vals)):
    if( vals[i] < vals[j] ):
    a = vals[i]
    vals[i] = vals[j]
    vals[j] = a
    for i in range(len(vals)):
    print(vals[i])

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

    On the 26th tutorial. starting as a complete Noob! however... your videos may be making me over confident lol. other than your very fast dialect you are one of the greatest teachers i have yet to encounter lol. thank you for posting these videos. Your hard work is very much appreciated.

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

    from array import *
    a=array('i' , [2,6,5,0,1])
    b=array('i',[])
    for y in range(max(a)+1):
    if y in a:
    b.append(y)
    else:
    pass
    print(b)

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

      it cannot order the negative numbers i-e(-6)

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

    from array import*
    valu = array('i',[5,4,3,2,1])
    vals = sorted(valu)
    newarr = array(valu.typecode,vals)
    for e in newarr:
    print(e)

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

    The quiz questions at the end are being covered. Can you please mention it in the description

    • @mr.professor593
      @mr.professor593 3 ปีที่แล้ว +2

      true the sub button must be placed at bottom right

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

    q-2 searching number
    import array as arr
    nums=arr.array('i',[9,16,13,12])
    i=0
    value=int(input("enter the value to search"))
    while i

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

    from array import *
    yes = array('i',[33,44,22,11])
    print(sorted(yes))

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

      in qustion, it is asked for alphabet arrangement

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

      am telling you you've done a good job... i went in the bush.... lol

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

      thnx man it helped me

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

      bro where you get aaray in pycham aaray is working

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

      Lol write the code in loop not pre defined functions 💩💩💩💩🤦‍♂️💩💩

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

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

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

    program 1
    from array import*
    vals= array('i',[2,5,1,3,6,4,9,8,7])
    print(sorted(vals))
    program 2
    from math import*
    x= int(input('enter a no'))
    print(factorial(x))

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

    For finding the factorial of a number:-
    x = int(input("enter the number"))
    y=1
    if(x

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

    sir im enjoying the python course
    you are doing such A GRAET WORK

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

    I should thank you for Python Videos, I have spent lot of money for coaching center and learnt nothing. this is the best tutorial till now I found. many thanks to you.

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

    n=int(input("no.?"))
    i=1
    out=1
    while i

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

      nice ,different solution

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

      Fk it's working

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

    Such a great lesson, genuinely considering learning hindi just to honor one of the best teachers I've ever had!

  • @mamodul-kabir
    @mamodul-kabir 5 ปีที่แล้ว +3

    Solution for no 1
    from array import array as a
    nums = a("i",[99,85,57,91,100])
    l = list(a for a in nums)
    l.sort()
    nums = a("i",(a for a in l))
    print(nums)

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

      You may also use nums only in place of a for a in nums, just to improve efficiency

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

    Answer1
    from array import *
    b=array('i',[])
    n=int(input("Enter the length of array"))
    for i in range(n):
    x=int(input("Enter the next value"))
    b.append(x)
    for i in range(len(b)):
    for j in range(i+1,len(b)):
    if b[i]>b[j]:
    b[i],b[j]=b[j],b[i]
    print(b)
    Answer 2:
    n=int(input("Enter a number of which you want to find factorial for"))
    for i in range(n-1,0,-1):
    n=n*i
    print(n)
    print("The factorial of the given number is",n)

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

    sorting an array without using inbuilt function
    from array import *
    arr = array('i',[6,23,44,21])
    for i in range(4):
    for j in range(i+1):
    if arr[j]>arr[i]:
    arr[j],arr[i] = arr[i],arr[j]
    for x in range(4):
    print(arr[x])

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

    You are the only teacher who makes me feel that coding is not so difficult as I think.. Thank you sir

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

    no=int(input("Enter any number: "))
    fact=1
    for n in range(no,1,-1):
    fact=fact*n
    print("The factorial of ",no," is: ",fact)

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

      In range u have to give 0 in 2nd place
      Not 1 😔

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

      She saved time by eliminating multiplication with 1.

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

    Answers:
    (a)
    from array import *
    a=array('i', [12,10,18,2,17,29])
    print(sorted(a))
    (b)
    a = int(input("Enter any number: "))
    for i in range(1, a):
    a = a*i
    print(a)

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

    n=int(input("Enter the number whose factorial you want to know: "))
    m=1
    for i in range(1,n+1):
    m=m*i
    print(m)

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

      Why n+1 ??

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

      @@soumsgaming238 because it will go from 1 to n.. definition of range

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

      @@hritwikhaldar9272 Accha thank you I am learning python

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

      Hritwik Haldar Hey a try fixing your code bit ! It doesn’t work if I give 0 😁😉

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

    from array import *
    v=array('i',[12,3,5,6,1,0])
    p=sorted(v)
    print(p)
    Code to arrange in ascending order

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

    #sorted arrays
    from array import *
    vals = array("i" ,[5,9,11,16,3,10,2,1,6])
    values = array(vals.typecode , (i for i in vals))
    values = sorted(values)
    for i in values:
    print(i)
    #factorial
    from math import *
    x = int(input("Enter the number:"))
    for i in range(x):
    x = factorial(x)
    print(x)
    break

  • @dr.i.kullayamma9750
    @dr.i.kullayamma9750 5 ปีที่แล้ว +1

    Sorting array without using sorted() -
    from array import *
    arr=array('i',[4,3,1,2,5,23,45,56,12,7,9])
    for i in range(len(arr)):
    for j in range(len(arr)-i-1) :
    if arr[i]>arr[i+j+1] :
    arr[i],arr[i+j+1]=arr[i+j+1],arr[i]
    print(arr)
    Sir your Lectures are really amazing , Thanks a lot for helping us. Mee lanti teachers undadam maaku chaala anandamga undi. Future lo inka chaala videos upload chestarani aasistunnamu.

  • @Bakchod_bawandars
    @Bakchod_bawandars 4 ปีที่แล้ว +51

    I like the style in the end of every video--" ba biie" 🤭🤭😂😂

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

    n = int(input('Enter the Number= '))
    for i in range(1,n):
    n = n*i
    print('Factorial of the Number is=',n)

  • @pavanjain2178
    @pavanjain2178 6 ปีที่แล้ว +12

    Finally the wait is over 2 days was a long time without you sir😊
    We love you sir

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

    The best videos i have ever seen... U discussed every basic , which is extremely extremely extremely beneficial 😍😍... I m a beginner and also faced a lot of difficulties.. but after seeing ur vdos , now i m clear about python.. my next mission is Django... And i will follow ur videos so that I don't face any kind of difficulties...thank you sooooooooooooooo muchh🥰🥰🥰🥰🥰🥰

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

    assigning old array to new:
    vals=array('i',[1,2,3,4])
    newarray=vals
    this above statement also works then why we are doing this:-
    newarray=array(vals.typecode,(a for a in vals))

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

      What happens in a for a in vals? I didnt get that

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

      @@kalyan762 Here, "for a in vals" is similar to for loop, where "a" is a variable,used to traverse the vals. It picks values of array one by one and do the operation, since here only a(before for) is present it copies the array as it is.
      The only benefit of using this concept is that,we can do certain operations with all the values of vals and stores it in a new array but this is not possible with the syntax ->(newarray=vals)
      Ex-> newarray=array(vals.typecode,(3*a for a in vals)) ,multiplies every element of array with 3 and stores it in new array.
      Hope this will help you :)

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

      @@sameernayak9611 thanks a lot for such clear explanation

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

    from array import *
    a = array('i', [5, 4, 2, 3, 1, 56, 1])
    print(a)
    for i in range(len(a)):
    for j in range(len(a)):
    if a[i] < a[j]:
    a[i], a[j] = a[j], a[i]
    print(a)

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

    Thank you sir🎉

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

    2) Factorial
    from array import *
    num = int(input("enter the number"))
    x = list()
    while num > 0:
    x.append(num)
    num = num - 1
    print(x)
    y = int(1)
    for i in x:
    y = i * y
    print(y)

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

    Best tutor on TH-cam for Python!

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

    #Factorial
    num=int(input("Enter number: "))
    fact=1
    while(num>0):
    fact*=num
    num-=1
    print("factorial is: ",fact)

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

      why my program is not working
      x=int(input('enter a no'))
      num=1
      while x>num:
      x=x*num
      num=num+1
      print(x)

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

      lol,my num is 1, how can i make it num-1, it will go to zero then negative

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

      actually i think my logic is wrong,ad on decrementing x also,nothing will happen....
      u check on ur complier u'll know.
      Btw, do u know from where to learn ML

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

      @@neelesh621 nope i don't know

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

    I've warched and searched so many videos on internet but found no one conceptual however Reddy's lectures are conceptual and has practical approch.
    Stay blessed reddy bro

  • @chinmaydas4053
    @chinmaydas4053 6 ปีที่แล้ว +29

    Sir whole day we eagerly wait for your quality, elaborately discussed videos but recently someday you don't upload even a single video.. Please sir at least upload two your quality videos daily 🙏🙏..

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

      Instead of replying, our tutor gave you a 'Heart Like', I wonder 'Like' is the acceptance of your request or what....

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

      Donate; lol. You're at the mercy of an electronic guru/sensei

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

    2nd quiz question answer
    x = input("enter the number for the factorial")
    i = 1
    fact = 1
    while i

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

    """lets try and sort an array in ascending order"""
    from array import *
    vals=array('i',[9,2,8,6,7])
    print(vals)
    for i in range(5):
    for j in range(i+1,5):
    if vals[i]>=vals[j]:
    vals[i],vals[j]=vals[j],vals[i]
    print(vals)

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

      It works but it's not efficient..

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

      @@leepierrelephiri7944 any suggestions..wat can be done? pls help

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

      @@gauravmalhotra007No limits in programming. There are multiple ways of doing it since people take different approach, the most preferred method is the simple one to save memory.
      .
      >>>vals.sort(reverse = True)

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

      @@leepierrelephiri7944 thank u

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

      @@gauravmalhotra007 '''vals[i],vals[j]=vals[j],vals[i]''' can you plz help explain me this line!!!!

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

    def f(x):
    if x==1:
    return 1
    else:
    return (f(x-1)*x)
    x=int(input("Enter:"))
    print(f(x))
    Code for finding factorial of a number
    I have used the method of recursion here

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

    num=8
    fact=1
    if fact

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

      shouldn't it be num instead of fact in if else statement

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

      Keepe Print(fact) with for loop
      Otherwise it will print all the values

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

    finally i have command over range in python,
    here is solution for Q2:
    x=int(input("factorial of which num you want"))
    f=1
    for i in range(x+1,1,-1):
    print(f, "*", i," = ",end=" ")
    f=f*i
    print(f)
    print("process complete: factorial of ",x," is :",end=" ")
    print(f)
    glad to learn python with navin,
    thank you.

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

    2nd
    import math
    x=int(input(" enter the value"))
    var=math.factorial(x)
    print(var)

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

      Hehe, nice work lazy dude!

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

      how can i repeat this script?
      after getting the result it should ask for another number to enter

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

    Sir... copying array works like simple variable assignment. array1 = newArr, we don't need to use typecode, for and all. It worked. :)
    #Arrays in python, copy one array to other array
    from array import *
    intArr = array('i',[1,2,4,6,8,3,7])
    intArr2 = intArr #assgn (copy) intArr to new array intArr2
    for e in intArr2:
    print(e)
    Output:
    1
    2
    4
    6
    8
    3
    7
    Process finished with exit code 0

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

    2)
    a=int(input("Enter any number:"))
    for i in range(1,a):
    a=a*i
    print(a)

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

      Great! But it does not work for a=0 (i.e. 0! = 1)
      Solution (considering only positive or null values of a):
      a = int(input("Enter any number: "))
      f = 1
      for i in range(1,a+1):
      f *= i
      print(f)

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

    im not enjoying the series....im relishing it!!....Sir u are a blessing for newbies like me!!!

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

    You are a very good teacher. Love your Python tutorials! Thank you!!

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

    1:
    from array import *
    vals = array ('i', [2,4,-6,8,] )
    svals = sorted(vals)
    print(svals)
    2:
    n= int(input("Enter the value of a number"))
    factorial=1
    while n>1:
    factorial=factorial*n
    n=n-1
    print(factorial)

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

    from array import *
    arr=array('i',[3,8,5,9,3,6])
    arr1=sorted(arr)
    print(arr1)

    • @Rajkumar-vc2pg
      @Rajkumar-vc2pg 5 ปีที่แล้ว

      For descending order?

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

      @@Rajkumar-vc2pg just type above print(arr1)
      arr1.reverse() then you will get decending order

    • @Rajkumar-vc2pg
      @Rajkumar-vc2pg 5 ปีที่แล้ว

      @@raghavchakravorthy3896 yea I'm liking that.. But i don't think it is efficient way to do

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

      factorial???

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

      Sort not working in array

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

    He taught the for loop in arrays. What a LEGEND!

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

    2..........
    import math
    x=int(input('enter the value '))
    for i in range(2,x+1):
    if x%i==0:
    print('factorial of number is',i)

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

      code isn't working brother!

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

    import math as m
    x=int(input('enter the number;-'))
    print(m.factorial(x))

  • @AakashKumar-ru4gv
    @AakashKumar-ru4gv 5 ปีที่แล้ว +4

    Answer 2:
    from array import *
    val = int(input("number"))
    result = 1
    for x in range(1,val+1):
    result*=x
    print(result)

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

    2.ans
    import math as m
    x=int(input("enter num of you want factorial"))
    print(m.factorial(x))

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

    2.
    n = int(input('Enter the number '))
    count = 1
    for i in range(1, n+1):
    count = count * i
    print(count)

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

    1)
    import array as a
    v=a.array('i',[98,76,56,99,45,44])
    print(sorted(v))
    2) i think second assignment question is factorial of given number
    import math
    num=int(input("enter the number which your going to do factorial : "))
    b=math.factorial(num)
    print(b)
    or
    import math as a
    num=int(input("enter the number which your going to do factorial : "))
    b=a.factorial(num)
    print(b)
    or
    from math import factorial
    num=int(input("enter the number which your going to do factorial : "))
    l=factorial(num)
    print(l)

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

    #solution 1st problem
    from array import *
    val=array('i',[2,10,3,4,6])
    val=sorted(val, key=int)
    print(val)

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

      hey hi your code is working fine even without the ("key = int"). May I know y u place the key keyword.

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

      Wats the use of key ?

    • @ramakrishna-pt8ne
      @ramakrishna-pt8ne 6 ปีที่แล้ว

      Print(sorted(var)) will do

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

    i am glad that i found your channel on top when i searched for python and rest is history.
    Thanks😊❤

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

    Great work
    Please make videos on the python projects
    It will be very helpful to us

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

    To find the factorial of a given number without using math.factorial
    n=int(input("Enter a number"))
    if n0:
    p=n
    for a in range(1,n):
    m=p*a
    if a==n-1:
    print(m)
    elif a

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

    from array import *
    vals = array('d',[4,3,1,12])
    vals=sorted(vals)
    print(vals)

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

    really found this channel very useful any people dont go deep in beginners python but u taught us from basic to deep so very much thankyou to u sir

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

    Solution for 2.
    No=5
    Fact=1
    For i in range(1,no+1):
    Fact=fact*I
    Print (fact)

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

    Your explanation is very nice 👍👍

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

    Solution of 1st problem
    From array import *
    S = array('i',[9,2,40,91,51,2])
    For i in sorted (s):
    Print (i)

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

    1. A code to sort the array in ascending order
    alphabets = array('u', ['a', 'q', 'b', 'k', 'z', 'f'])
    print(sorted(alphabets))
    nums = array('i', [55, 7, 0, 65, 20, 34])
    print(sorted(nums))
    2. A code to find the factorial of given number
    fact = array('i', [2, 5, 3, 7])
    for f in fact:
    print(factorial(f))

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

    I have a doubt:-
    In lists we done like
    Nums.sort()
    But in array it is not working?

  • @shreyaansjain.181
    @shreyaansjain.181 3 ปีที่แล้ว +2

    Print("No.1 coding teacher in India. Salute to this man")

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

    Its very confusing....array array....yeh array array kya hai yeh array array

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

    I'm new to Python
    I am learning a lot from you
    thank you my guru :D

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

    Instead of writing newArr = array(vals.typecode, (a for a in vals)).
    cant we directly write newArr = vals

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

      Cool

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

      We can but if we want more requirement in further, we has to initiate the typecode and requirement. It is better to know the depth subject right :)

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

      newArr = vals doesn't create a new array, it assings the 'vals' array to the 'newArr' tag. Thus, each change on the 'vals' array will affect the 'newArr' array, as these are the same arrays. But, it seems that works fine:
      newArr = array(vals.typecode, vals)