#26 Python Tutorial for Beginners | Array in Python

Поділитися
Вставка
  • Опубліковано 4 лип 2024
  • Check out our courses:
    Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : bit.ly/java-spring-cloud
    Udemy Courses:
    Java:- bit.ly/JavaUdemyTelusko
    Spring:- bit.ly/SpringUdemyTelusko
    Java For Programmers:- bit.ly/javaProgrammers
    For More Queries WhatsApp or Call on : +919008963671
    website : courses.telusko.com/
    Instagram : / navinreddyofficial
    Linkedin : / navinreddy20
    TELUSKO Android App : bit.ly/TeluskoApp
    In this lecture we are dicussing about for else loop:
    -- The for-else loop in Python is a control flow structure that combines the for loop and else
    statement. The for loop iterates over a sequence of items, and the else statement is executed
    after the loop is completed, provided that the loop was not terminated prematurely by a break statement.
    Here's the basic syntax:
    for item in sequence:
    loop body
    else:
    else block
    -- The sequence can be any iterable object, such as a list, tuple, or string. The loop body is executed
    once for each item in the sequence, and the item variable takes on the value of each item in turn.
    -- If the loop completes normally, without encountering a break statement, then the else block is executed.
    This can be useful for executing cleanup code or performing some final action after the loop is finished.
    nums=[12,15,18,21,26]
    #get first number divisble by 5 print from list and we want if number is not divisible by 5 then print not found every time
    for num in nums:
    if num% 5==0:
    print(num)
    break
    else:
    print("not found")
    #get first number divisble by 5 print from list and we want if number is not divisible by 5 then print not found once
    nums=[23,24,27,38,29]
    for num in nums:
    if num% 5==0:
    print(num)
    break
    else:
    print("not found")
    Github :- github.com/navinreddy20/Python-
    Python for Beginners :- bit.ly/3JOLQhl
    Java:- bit.ly/JavaUdemyTelusko
    Spring:- bit.ly/SpringUdemyTelusko
    More Learning :
    Java :- bit.ly/3x6rr0N
    Python :- bit.ly/3GRc7JX
    Django :- bit.ly/3MmoJK6
    JavaScript :- bit.ly/3tiAlHo
    Node JS :- bit.ly/3GT4liq
    Rest Api :-bit.ly/3MjhZwt
    Servlet :- bit.ly/3Q7eA7k
    Spring Framework :- bit.ly/3xi7buh
    Design Patterns in Java :- bit.ly/3MocXiq
    Docker :- bit.ly/3xjWzLA
    Blockchain Tutorial :- bit.ly/3NSbOkc
    Corda Tutorial:- bit.ly/3thbUKa
    Hyperledger Fabric :- bit.ly/38RZCRB
    NoSQL Tutorial :- bit.ly/3aJpRuc
    Mysql Tutorial :- bit.ly/3thpr4L
    Data Structures using Java :- bit.ly/3MuJa7S
    Git Tutorial :- bit.ly/3NXyCPu
    Donation:
    PayPal Id : navinreddy20
    www.telusko.com
  • Наука та технологія

КОМЕНТАРІ • 1 тис.

  • @Luka-se7sl
    @Luka-se7sl 4 роки тому +558

    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 3 роки тому +18

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

    • @jabi24
      @jabi24 2 роки тому +1

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

    • @user-ec8ig4cb7w
      @user-ec8ig4cb7w 3 місяці тому

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

  • @krishnajadhav867
    @krishnajadhav867 5 років тому +555

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

  • @abhishekbajpai9920
    @abhishekbajpai9920 5 років тому +464

    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.

  • @ashu__risiofficial5887
    @ashu__risiofficial5887 4 роки тому +76

    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.

  • @sumanthkumar4035
    @sumanthkumar4035 4 роки тому +121

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

  • @srivathsanm745
    @srivathsanm745 3 роки тому +27

    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 роки тому +6

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

  • @puneetdhangwal84
    @puneetdhangwal84 4 роки тому +44

    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 3 роки тому

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

    • @adityamane9312
      @adityamane9312 3 роки тому

      How did u get this??

    • @shaunakshukla7984
      @shaunakshukla7984 3 місяці тому

      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 3 роки тому +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 .

  • @hrithicksen3644
    @hrithicksen3644 5 років тому +41

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

  • @Anishbhosle14
    @Anishbhosle14 4 роки тому +16

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

  • @BoomcoreIsLive
    @BoomcoreIsLive 5 років тому +67

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

    • @dhruvdutt2749
      @dhruvdutt2749 3 роки тому +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 3 роки тому

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

    • @dhruvdutt2749
      @dhruvdutt2749 3 роки тому

      @@harikpriyatirumalaraju674 not in my situation

    • @harikpriyatirumalaraju674
      @harikpriyatirumalaraju674 3 роки тому

      Dhruv Dutt why?

    • @dhruvdutt2749
      @dhruvdutt2749 3 роки тому

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

  • @ale94ge
    @ale94ge 4 роки тому +9

    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

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

  • @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 роки тому +1

      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

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

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

  • @ritiksoni6976
    @ritiksoni6976 5 років тому +9

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

  • @abdullahstutorial5319
    @abdullahstutorial5319 4 роки тому +16

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

    • @shaunakshukla7984
      @shaunakshukla7984 3 місяці тому

      bhai galat hh isme direct value print kr dega

    • @shaunakshukla7984
      @shaunakshukla7984 3 місяці тому

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

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

  • @cadurgesh
    @cadurgesh 3 роки тому +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!!

  • @Bakchod_bawandars
    @Bakchod_bawandars 4 роки тому +51

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

  • @Letz_Connect
    @Letz_Connect 3 роки тому +2

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

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

  • @CultOfJ
    @CultOfJ 4 роки тому +20

    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 )

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

  • @anasuyasaha1605
    @anasuyasaha1605 3 роки тому +1

    I think this is the best python short tutorial.worth watching.
    Thank you very much.

  • @SankarKumar-on8tn
    @SankarKumar-on8tn 4 роки тому

    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

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

  • @pavanjain2178
    @pavanjain2178 6 років тому +12

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

  • @dr.i.kullayamma9750
    @dr.i.kullayamma9750 4 роки тому +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.

  • @BrainProHub
    @BrainProHub 4 роки тому +2

    Thank you very much for your valuable videos on python..it's simply amazing. You made Python very simple and easy to understand. Once again thank you for your effort.

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

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

  • @agnitapaul1229
    @agnitapaul1229 3 роки тому +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🥰🥰🥰🥰🥰🥰

  • @Alberta_Farmer
    @Alberta_Farmer Рік тому +2

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

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

  • @akifkhan2966
    @akifkhan2966 5 років тому +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 4 роки тому +2

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

    • @chaitanyachaitu6367
      @chaitanyachaitu6367 3 роки тому

      Here you use selection sort algorithm am I correct?

  • @topgameplay4897
    @topgameplay4897 3 роки тому +2

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

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

  • @fitnesskanacke1509
    @fitnesskanacke1509 5 років тому +3

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

  • @NaveenKumar-or1jd
    @NaveenKumar-or1jd Рік тому +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

  • @srijakukutapu9289
    @srijakukutapu9289 4 роки тому +1

    Thank you. It is more easy than I expected by your way of teaching.

  • @nehaarora2441
    @nehaarora2441 Рік тому +2

    What a fantastic content sir! You are a great help to us...loving the python series. Thank you for your indeed efforts.

  • @muhammedthanveer1662
    @muhammedthanveer1662 4 роки тому +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)

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

  • @filmgeeks3595
    @filmgeeks3595 5 років тому +2

    Been watching your videos all day sir
    Feel like i have pretty decent grab of python
    Thanks sir!

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

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

  • @sangitabanerjee1724
    @sangitabanerjee1724 5 років тому +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 4 роки тому

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

    • @BaapBaapBetaBeta
      @BaapBaapBetaBeta 4 роки тому

      She saved time by eliminating multiplication with 1.

  • @shivamhandore2213
    @shivamhandore2213 4 роки тому +1

    Thank a lot sir for such amazing teaching......we need teachers like u .....

  • @MuhammadBilal-xq1dw
    @MuhammadBilal-xq1dw 2 роки тому

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

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

  • @pravinpathade3237
    @pravinpathade3237 5 років тому +4

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

  • @ngapmennyamiyannick7434
    @ngapmennyamiyannick7434 6 років тому +1

    you have the gift of teaching things very easily

  • @QVL75
    @QVL75 2 роки тому

    I like your video. Easy to understand. Learn new things as well as reinforce things I already know in a short time.

  • @vishnupriyam2926
    @vishnupriyam2926 4 роки тому +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

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

  • @bordercut1
    @bordercut1 2 роки тому +1

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

  • @babukumar9869
    @babukumar9869 6 років тому

    Love on python increases day by day with ur tutorials!!

  • @taimoormuxtafa2219
    @taimoormuxtafa2219 4 роки тому +4

    "Sorted Numbers in ascending order"
    from array import *
    nums = array('i',[4, 3, 5, 6, 1])
    for i in range(len(nums)):
    for j in range(len(nums)-1):
    if nums[j] > nums[j + 1]:
    temp = nums[j + 1]
    nums[j + 1] = nums[j]
    nums[j] = temp
    print(nums)

    • @roshanloke9423
      @roshanloke9423 4 роки тому +1

      Hai I cant understand will be please help me by explaining that

    • @abhradeepdey2640
      @abhradeepdey2640 3 роки тому

      Directly use *list.sort()* function

    • @abhradeepdey2640
      @abhradeepdey2640 3 роки тому

      print("LIST SORTER:-

      ")
      n=int(input("enter the number of elements to be inserted and sorted: "))
      def sort(a):
      for passnumber in range(len(a)-1,0,-1):
      for i in range(passnumber):
      if a[i]>a[i+1]:
      m=a[i]
      a[i]=a[i+1]
      a[i+1]=m
      a=[]
      for i in range(0,n):
      x=int(input("enter element: "))
      a.append(x)
      sort(a)
      print(a)
      Or use this

  • @arnicpaul7347
    @arnicpaul7347 4 роки тому +8

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

  • @gabrieltan3203
    @gabrieltan3203 2 роки тому +2

    Hey sir! Excellent video; explanation is very clear and easy to follow. I just have one piece of feedback: I was wondering if you could edit the closed captions for this video? I have noticed some instances where the auto-generated captions display the wrong words (for example, around the 2.5-minute mark, import Eddie as so instead of import array as arr) and this might make it more difficult for the folks globally who rely on closed captions to understand the videos. Thank you very much and have a great day!

  • @srivanikothavadla4606
    @srivanikothavadla4606 5 років тому +1

    thank you soo much Naveen Reddy sir for providing such a valuable vedios....thank u you tub

  • @karthimk2284
    @karthimk2284 5 років тому +6

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

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

  • @tylerlansing4319
    @tylerlansing4319 2 роки тому +2

    Thank you so much for this, your lesson has been most helpful.

  • @Victories1995
    @Victories1995 4 роки тому

    Superb. I have never seen so attractive way of learning. Thanks alot :-) :-)

  • @star_sdm2023
    @star_sdm2023 4 роки тому +4

    num=8
    fact=1
    if fact

    • @akshayyadav6926
      @akshayyadav6926 4 роки тому

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

    • @hiteshdama3984
      @hiteshdama3984 3 роки тому

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

  • @justsomeguywithoutamustach9978
    @justsomeguywithoutamustach9978 4 роки тому +3

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

  • @gpsnavi
    @gpsnavi 4 роки тому +1

    Thank you very much for your videos...I have taken on so much useful information!!

  • @vk6297
    @vk6297 4 роки тому

    excellent explanation sir especially while saying about coping array values into a new array

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

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

  • @jackwo95
    @jackwo95 6 років тому

    Great as always sir, I really enjoy watching your videos!

  • @satyahangrai3648
    @satyahangrai3648 5 років тому

    love from NEPAL sir > YOur explantion is just wow...... I totally understand about basic of python becz of u sir thank you.

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

  • @bhagya1652
    @bhagya1652 4 роки тому +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)

  • @ankitshukla5800
    @ankitshukla5800 5 років тому

    Sir your way of teaching is excellent
    Keep it up sir
    Plz upload programming videos in python

  • @abadymax0
    @abadymax0 2 роки тому +1

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

  • @ankitnarang4226
    @ankitnarang4226 5 років тому +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

  • @kranthikumar1758
    @kranthikumar1758 5 років тому +6

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

  • @SaiRam-bo2ud
    @SaiRam-bo2ud 6 років тому +1

    i love ur explaining skills sir keep posting more and more

  • @pranjalschoubey.puretech668
    @pranjalschoubey.puretech668 3 роки тому +1

    Fantastic explanation of array. And thanks for giving data type signs.😁

  • @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 4 роки тому

      For descending order?

    • @raghavchakravorthy3896
      @raghavchakravorthy3896 4 роки тому +1

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

    • @Rajkumar-vc2pg
      @Rajkumar-vc2pg 4 роки тому

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

    • @manishmalik.
      @manishmalik. 4 роки тому

      factorial???

    • @prasadchowdary4701
      @prasadchowdary4701 4 роки тому

      Sort not working in array

  • @theone4159
    @theone4159 5 років тому +5

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

  • @RANJANKUMAR-uq2ef
    @RANJANKUMAR-uq2ef 4 роки тому

    Sir in your teaching techniques is very technical and just realised you to something me it's good for understanding thanks and bye baii

  • @shreyaansjain.181
    @shreyaansjain.181 3 роки тому +2

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

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

  • @adityatandon4156
    @adityatandon4156 5 років тому +4

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

    • @Mrallrounderr
      @Mrallrounderr 5 років тому

      Cool

    • @kranthikumarkotagiri9334
      @kranthikumarkotagiri9334 5 років тому +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 5 років тому +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)

  • @sukanyabaliarsingh204
    @sukanyabaliarsingh204 3 роки тому +1

    Best tutor on UA-cam for Python!

  • @amanasci2481
    @amanasci2481 6 років тому

    Welcome back sir...
    Was waiting for you eagerly..

  • @sandeepchand3143
    @sandeepchand3143 5 років тому +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!

  • @erinfolamiquadri3406
    @erinfolamiquadri3406 5 років тому +6

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

  • @dileeppatted9967
    @dileeppatted9967 2 роки тому +1

    Everytime you ask , hope you are enjoying the series? Dude, we are in love with this series!

  • @indushreeshanthachary5519
    @indushreeshanthachary5519 5 років тому

    Ur the only person I'm feeling easy to learn from basics.. Plz do make a joins concept in mongodb.. No one has done easily plz

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

  • @sudhakarverma8452
    @sudhakarverma8452 5 років тому +3

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

  • @ExploreMalaya
    @ExploreMalaya 3 роки тому

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

  • @reetipandey9446
    @reetipandey9446 5 років тому

    Sir u are awesome literally I am totally impressed by the way u teach