#26 Python Tutorial for Beginners | Array in Python

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

Комментарии • 1 тыс.

  • @abhishekbajpai9920
    @abhishekbajpai9920 6 лет назад +480

    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.

  • @krishnajadhav867
    @krishnajadhav867 5 лет назад +582

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

  • @Luka-se7sl
    @Luka-se7sl 4 года назад +602

    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 года назад +19

      One reason being, Google/RUclips 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 7 месяцев назад +2

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

    • @aadarshm2008
      @aadarshm2008 2 месяца назад +1

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

  • @ashu__risiofficial5887
    @ashu__risiofficial5887 4 года назад +81

    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

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

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

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

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

  • @puneetdhangwal84
    @puneetdhangwal84 4 года назад +46

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

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

      that helps thank you :)

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

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

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

      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

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

  • @BoomcoreIsLive
    @BoomcoreIsLive 5 лет назад +67

    #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 *

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

  • @sumanthkumar4035
    @sumanthkumar4035 4 года назад +127

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

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

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

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

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

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

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

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

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

  • @beautifullifejourney28liza
    @beautifullifejourney28liza Месяц назад +2

    Your explanation is very nice 👍👍

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

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

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

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

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

    Thank you sir🎉

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

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

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

  • @Anishbhosle14
    @Anishbhosle14 4 года назад +18

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

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

  • @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 2 года назад

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

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

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

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

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

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

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

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

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

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

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

    Best tutor on RUclips for Python!

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

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

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

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

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

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

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

    Ascending program
    from array import *
    a=array(‘i’, [1,3,9,8,2,5]
    y=sorted(a)
    print(y)
    output: [1,2,3,5,7,9]
    Descending progarm
    from array import *
    a=array(‘i’, [1,3,9,8,2,5]
    y=sorted(a)
    y.reverse()
    print(y)
    output: [9,7,5,3,2,1]
    factorial program
    from math import *
    n=int(input(“enter a number”)
    f=factorial(n)
    print(f)

  • @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 💩💩💩💩🤦‍♂️💩💩

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

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

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

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

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

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

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

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

    a=int(input("enter any number "))
    c=0
    for i in range(1,a+1):
    if a%i==0:
    c=c+1
    print(i,"are the factors")
    if(c==2):
    print(a,"is prime no")
    else:
    print(a,"is composite number")
    print("total number of factors",c)

  • @ritiksoni6976
    @ritiksoni6976 5 лет назад +9

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

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

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

  • @MuhammadBilal-xq1dw
    @MuhammadBilal-xq1dw 2 года назад

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

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

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

    a=int(input("enter number"))
    fact=1
    i=1
    while(i

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

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

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

  • @roja7949
    @roja7949 5 месяцев назад

    for array in ascending order:
    from array import array
    value=array('i',[9,8,5,0,2,7])
    a=sorted(value)
    print(a)
    for factorial of given number:
    import math
    a=int(input("enter num:"))
    print(math.factorial(a))

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

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

    from array import *
    import math
    a = array('i',[])
    i = 1
    j = int(input('How many nums:
    '))
    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!!!!

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

  • @Bakchod_bawandars
    @Bakchod_bawandars 4 года назад +51

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

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

    #-----finding a given number in an array-----
    x= int(input("enter the no you wanna find in the array"))
    for i in range(len(vals)):
    if x==vals[i]:
    print("no is present at location : ",i+1)
    break
    else: print("no luck")

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

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

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

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

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

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

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

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

    array sort:
    ------------------
    ascending order:
    import array
    vals=array.array('i',[5,2,3,4,1,6])
    n=len(vals)
    for e in range(n):
    for j in range(1,n-e):
    if vals[j-1]>vals[j]:
    (vals[j-1],vals[j])=(vals[j],vals[j-1])
    print(vals)

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

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

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

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

  • @pavanjain2178
    @pavanjain2178 6 лет назад +12

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

  • @SantoshSahu-nd1bw
    @SantoshSahu-nd1bw 6 лет назад

    PROGRAM1:
    from array import array
    arr = array('i',[5,4,3,2,0])
    for i in range(len(arr)-1):
    j=0
    while jarr[j+1]:
    t=arr[j]
    arr[j]=arr[j+1]
    arr[j+1]=t
    j+=1
    for e in arr:
    print(e,end=" ")
    PROGRAM2:
    x = int(input("Enter a number to find factorial: "))
    fact=1
    while x>1:
    fact*=x
    x-=1
    print("Factorial = ",fact)

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

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

    thank you sir you make it so easy to understand

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

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

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

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

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

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

  • @2010aArush
    @2010aArush Год назад

    Ascending order
    array1= array('i',[34,12,45,9,78])
    l= len(array1)
    for i in range(l):

    for j in range(i+1,l):
    if array1[i]>= array1[j]:
    temp = array1[i]
    array1[i]=array1[j]
    array1[j]=temp
    for i in range(l):
    print (array1[i])

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

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

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

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

    2nd assignnment:
    fac = int(input("enter a number to get factorial"))
    import math as m
    result = m.factorial(fac)
    print(result)
    /////this is for loop concept for factorial
    s=1;
    for i in range(1,fac+1):
    s=s*i
    print(s)

  • @pravinpathade3237
    @pravinpathade3237 5 лет назад +4

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

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

    First:-
    from array import *
    values = list(array ('i',(2,5,3,7,1)
    val.sort()
    for i in val:
    print(i)
    Second:-
    val=6
    i=1
    c=1
    while i

  • @sudhakarverma8452
    @sudhakarverma8452 6 лет назад +3

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

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

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