Python Program For Matrix Addition and Subtraction

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

ความคิดเห็น • 100

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

    best teacher.. knowledge is appreciable and your voice is so melodious too. enjoying learning from here.

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

    Moat underrated channel for python

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

    Thanks a lot u helped me a lot during exams

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

    Thank you for this video.....I was waiting eagerly. I hope you will provide some good questions on matrices.

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

    Thank you very much mam. It helped us a lot for our Group Assignment. Again Thank you so much❤❤❤🥰

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

    very nicely explain thank you best wishes from nepal

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

    I've been trying to get the input from the users ,I watched this and completely understood the concept ,thank you ,I'm so happyyyy

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

    Good teacher, Super mam ,Nice way of teaching,more than thaat Your voice is awesome

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

    why u have not used list comphrension method for adding the matrices ? and why r u writing the for loop when u have given the necessary code for matrix1 and 2 in list comphrension method ?

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

    can you please explain why u use format function and how to use it

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

      To format the string or number :)
      Video link:
      th-cam.com/video/L19e53kEciI/w-d-xo.html

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

    wow you really helped me.....thank you

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

    Hey Amulya...
    I don't understand how the matrix list works (looks like a list comprehension)
    Can you explain it?
    If it is a list comprehension, can we get input from inside of the list?
    Please explain...
    And your videos are amazing and I love the way you teach

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

      here we are treating nested list as matrix.
      Yes in the program to enter value to the nested list(matrix) we used list comprehension method.
      matrix1 = [ [ int(input() for loop for column)] for loop for row ]
      this is the syntax.
      :)

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

      @@AmulsAcademy Thanks Amulya...

  • @karthikeyan-gy8tn
    @karthikeyan-gy8tn 3 ปีที่แล้ว +4

    Mam I use [[int(input() for i in range(row)]for j in range(col)]
    It give me same result when I interchanged col and row as u mentioned in this video I tried both its Gove same result

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

      Give me the program 😊

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

    Mam, please make more videos on Python Programming!

  • @vellaiyan.m0556
    @vellaiyan.m0556 4 ปีที่แล้ว +3

    (1:44) 3rows and 2 columns

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

    your teaching method is very nice. But the subtitle is needed

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

      Ok I will remember that :)

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

    for i in range (infinity):
    print("YOUR AMAZING MAN LOVE U❤")

  • @gayathri-8-i6s
    @gayathri-8-i6s 3 ปีที่แล้ว +1

    I have a doubt
    Y we r inputting matrix 1 as for i in range(col) for i in range (row)
    Y col first and row second
    And my another doubt is
    in for loop , for i in range(row) and for j in range (col) y row is first and col is second
    Y I can't use both as for i in range (row) first and for j in range (col) next
    Clear my doubt Sisy...

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

      For your first question :
      If I use [0 for i in range(5)] we will get [0,0,0,0,0]
      Now we got one row and 5 column and now if we want to print this in 4 rows then we need to take another for loop for that.
      [[0 for i in range(5)] for j in range(4)]
      I is column here and j is row.
      So first take for loop for column then take for loop to print how many row you want 😊
      Now for the second question:
      Here we want to print
      row0 col0 col1 col 2 col3 col4
      After that we need to go to second row (row1)
      That’s why here outer for loop is for loop for row and inner for loop is for loop for column 😊

    • @gayathri-8-i6s
      @gayathri-8-i6s 3 ปีที่แล้ว

      @@AmulsAcademy I understand first one. But not second

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

    if we giving the negative value it showing error, how we write global solution.

  • @gayathri-8-i6s
    @gayathri-8-i6s 3 ปีที่แล้ว +1

    Sisy...can you please explain each and every line with a example plzzzxx

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

      Each line explanation for matrix addition and subtraction .?

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

    thank you so much

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

    Can we write this:
    matrix1=[ [ int( input( ) ) for i in range(row) ] for j in range(col) ]
    insteaad of
    matrix1=[ [ int( input( ) ) for i in range(col) ] for j in range(row) ]
    If not then what is the reason behind this?

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

      You can write like this but you will get row number of column and col number of row in your output :)

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

    Can anyone help me with 3 line! I am confused of why 'col' is taken first in 'for' loop! 'for' loop works for eg.:
    #
    for i in [1,2]:
    for j in [3,4,5]:
    print([i][j])
    #
    Output: [[1,3], [1, 4], [1, 5], [2,3]...]
    _______
    If I need to input 2×3 matrix, why can't I put "row" in first "for" loop?

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

      i will explain this with list comprehension.
      when you take [0 for i in range(5) ] we will get output as [0,0,0,0,0]
      this is 1×5 array/list here, now if i want 3×5 list then i need to [0 for i in range(5) ]repeat this thrice/we need to loop this thrice.
      [[0 for i in range(5) ] for j in range(3)].

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

      @@AmulsAcademy How it will look using regular for loops ma'am?
      Thanks

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

    Amulya can u please make a video on stack ,linkedlist, queues...in python

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

      I will try :)

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

      @@AmulsAcademy no one had made a video on python data structure..u make a video it is useful for every one .. tq mam thanks for ur reply

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

    In list comprehension why we are giving Column first?

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

      So that we can use matrices which are not necessarily square

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

      @@mananchawla4751 how? can you explain step by step?

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

    Mam I am unable to follow this so can I use Numpy insted of this

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

    You're amazing✌

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

    very good

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

    At time line 5min why you use "

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

      To print values of matrix in a proper manner here i am formatting the values.
      To know more learn about format()

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

    Madam,please expalin the list comprehension of matrix1 varaible.I seen the previous videos of list comprehension,This kind of example not present in the previous list comprehension video

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

      [[int(input()) for i in range(col)] for j in range(row)]
      here first
      [int(input()) for i in range(col)] this will be executed.
      if i enter col as 4, it will take 4 value for column. { 4 times it will execute int(input()) and we will get 4 integer input }
      Next,
      for j in range(row)
      this for loop will execute.
      it will run
      [int(input()) for i in range(col)]
      this row times {if row is 3 it will run for loop 3 times.}

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

      Thank U madam for your kind Replay

  • @AJ-st5tj
    @AJ-st5tj 4 ปีที่แล้ว

    Hi amulya , can u pls make a video on functions ..u have made basic video ..pls make a video on....how functions can be called inside a function .how var in one functn n accessed with other function in python ...it's a request ,

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

      Watch closures video in amuls academy

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

    why do in list comprehension does column for loop comes first and row for loop second while printing its the opposite? also massive respect to you me lady

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

      if you use single list
      [ 0 for i in range(5)] it will create [0,0,0,0,0]
      that is the one row right now if i want 4 rows like that i need to write
      [[0 for i in range(5)] for j in range(4)]
      :)

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

    Thank you 🙂🙏🇮🇳

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

    Why we are using "end"???

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

      To print the number in same line :)

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

      Mam...If we didn't use end it will print one by one ah..

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

      @@charu4963 yes it will print one by one
      Because by default...end 's value is new line.. we need to give space " " so that it's printed in same line. If u have given 2 it would have printed 2 after every number
      phypythonics.wordpress.com/contents/
      You can check out the website

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

    Mam please consider the programs with lesser time complexity!

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

    Thank you.

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

    Could you please explain the for loop logic :
    [[int(input()) for i in range(col)] for j in range(row)]

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

      When you use
      [int(input()) for i in range(col)]
      it will given you a list with values.
      for example
      col=3
      if i enter input as 0
      then we will get [0,0,0] as output.
      but here we want nested list for matrix because matrix is 2d so we will use nested list here.
      [[int(input()) for i in range(col)] for j in range(row)]
      if row=4
      then i will get
      [0,0,0] 4 times.
      [[0,0,0],[0,0,0],[0,0,0],[0,0,0]]
      :)

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

      @@AmulsAcademy Thank you for your quick response :)

    • @gayathri-8-i6s
      @gayathri-8-i6s 3 ปีที่แล้ว +1

      @@AmulsAcademy if row =4
      0
      0
      0
      0
      Like this only??? Am I correct???

    • @karthikeyan-gy8tn
      @karthikeyan-gy8tn 3 ปีที่แล้ว +2

      @@gayathri-8-i6s yes but we can use [[int(input()) for i in range(row)]for j in range(col)]
      Or we can use
      [[Int(input()) for i in range(col)]for j in range(row)]
      We can use both output is same

    • @gayathri-8-i6s
      @gayathri-8-i6s 3 ปีที่แล้ว

      @@karthikeyan-gy8tn thanks a lot

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

    Madam,I cant understand the List comprehension can you please tell me in detail in the comment box

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

      I made few videos on list comprehension you can watch that :)
      th-cam.com/video/17gTGqHG5xQ/w-d-xo.html
      th-cam.com/video/fnJOBQbc7Qg/w-d-xo.html
      th-cam.com/video/JEapLNRuzVo/w-d-xo.html
      :)

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

    plzz start java programme language tutorial

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

    can u post the code

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

    I keep getting an error saying that the INT is not subscriptable

  • @gayathri-8-i6s
    @gayathri-8-i6s 3 ปีที่แล้ว +1

    This video is somewhat confusing me... Can you explain each and every for loop plz....

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

      I will give you simple tip
      Write down the program in a paper and trace the program, you will understand the flow of the programs 😊

  • @043mala.s8
    @043mala.s8 3 ปีที่แล้ว

    In the 4 line... i in range col and j in range row.. Ana next line la... i in range row and j in range in col.. Nu iruku.... Athu konjam explain paniringala

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

    Thank you madam

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

    We can also do it easily using numpy.

  • @PraveenKumar-gd1tx
    @PraveenKumar-gd1tx 4 ปีที่แล้ว +1

    Sir if two matrices are given and we want to add them what is the code for that???

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

    can you pleas explain the concept of end=' '

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

      end is the parameter in the print(), default value is
      that is new line.
      when i write
      print("hello")
      it will print message hello and goto the next line {because default value of end = "
      "}
      But if we want print stars or number in the same line then we can use end=""
      :)

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

      Thank you so much

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

    Tedious approach
    Gosh

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

    In list comprehension.
    for i in range(col) for j in range(row)
    but i is for row and j is for col?
    is it condition to make row=col?

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

      i and j are variables you can take any variable name here .
      :)

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

      @@AmulsAcademy got it thanks.

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

    please make a playlist for *Django*

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

    Voice ❤️💃

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

    OMG
    why does this video even has dislikes

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

    Wowwww