#23 Python Tutorial for Beginners | Printing Patterns in Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2024
  • Check out our courses:
    Spring Framework 8 Full-Day Course Live: go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    Enterprise Java Spring Microservices: go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : go.telusko.com...
    Coupon: TELUSKO20 (20% Discount)
    Udemy Courses:
    Spring: go.telusko.com...
    Java:- go.telusko.com...
    Java Spring:- go.telusko.com...
    Java For Programmers:- go.telusko.com...
    Python : go.telusko.com...
    Git : go.telusko.com...
    Docker : go.telusko.com...
    For More Queries WhatsApp or Call on : +919008963671
    website : courses.telusk...
    Instagram : / navinreddyofficial
    Linkedin : / navinreddy20
    TELUSKO Android App : bit.ly/TeluskoApp
    In this lecture we will learn:
    - How to implement the logic for pattern printing?
    - Pattern printing through python
    - Print the pattern of a square
    - Print the pattern of the right triangle and reverse right-triangle
    - Different approaches to printing a pattern
    #1
    - Pattern printing improves logical thinking capability.
    - Programming is all about solving the problem, we have to understand the problem statement and wrote code for it.
    - A pattern can be printed in many ways.
    - We can print multiple hashes(#) in a single statement as a string.
    - If you are allowed to print only hash in a statement at a time, then you have to write the same print statement multiple times.
    - On writing a statement multiple times, it will give an output in a column.
    - To convert a column output into a row format, we can use the end=" "parameter in every statement.
    - To will restrict the cursor to move on a new line and hashes(#) will be printed in a single row.
    #2
    - Instead of writing the same code multiple times, we can use a for a loop.
    - For a range(n) in a for loop, it will start from 0 and end at (n-1).
    - We can use two loops, for printing two rows separated by a new line.
    - For printing multiple rows, we have to write the same for loop code repeatedly.
    - So, we can write the above for loop block inside another outer loop.
    - In nested loops, an outer loop contains a variable that represents the number of rows and an inner loop contains a variable that represents the number of columns.
    #3
    - We can apply the concept to different patterns in a similar way.
    e.g., for printing a right -triangle, we can restrict the inner loop till the value of a number of rows.
    - For the reverse of the right triangle, we can restrict the inner loop till (n-i), where i is the number of rows.
    Python Tutorial to learn Python programming with examples
    Complete Python Tutorial for Beginners Playlist : • #1 Python Tutorial for...
    Python Tutorial in Hindi : • #1 Python Tutorial | I...
    Github :- github.com/nav...
    In this video we will see:
    - Printing patterns
    - Using loop
    - For loop
    Python for Beginners :- bit.ly/3JOLQhl
    Editing Monitors :
    amzn.to/2RfKWgL
    amzn.to/2Q665JW
    amzn.to/2OUP21a.
    Editing Laptop :
    ASUS ROG Strix - (new version) amzn.to/2RhumwO
    Camera : amzn.to/2OR56AV
    lens : amzn.to/2JihtQo
    Mics
    amzn.to/2RlIe9F
    amzn.to/2yDkx5F
    Java:- bit.ly/JavaUde...
    Spring:- bit.ly/SpringU...
    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

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

  • @AmarjeetKumar-do7iz
    @AmarjeetKumar-do7iz 6 ปีที่แล้ว +1288

    I can bet that no courses can be better then this even that is paid. I have purchased almost 5-6 courses form udemy but i couldn't find anyone better then this. A huge thanks to Mr Naveen Reddy Sir for providing this awesome courses and sir we really appreciate you for providing us such valuable resources.

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

      even i had some paid courses of udemy but this is the best ......

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

      Riyaz mhd hats off*

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

      @@sss2393 lol

    • @vasanthkumar-rq5cw
      @vasanthkumar-rq5cw 4 ปีที่แล้ว +3

      Yes,sssssssssssss

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

      sure he is out to create people's mind by removing litter of technology in our mind, thank sir

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

    str1='ABCD'
    str2='PQR'
    for i in range(4):
    print(str1[ : i+1 ] + str2[ i : ])

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

      Too good and easy method just loved it

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

      that's great :)

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

      Dont understand it properly...
      What does that statement means
      Print(str1[:i+1])
      :

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

      @@sonikunj696 it means from zero index to i+1 index all element.namely as range(0,i+1)

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

      @@sonikunj696 this sign defines interval i.e if u want to go from begining to 4th one element in the list,
      then u have to use like [ :5]

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

    that man needs much more recognition , seriously i learned from this guy in a couple of months what i learned from college in one academic year , not just in python , but his other topics and his logic

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

    I've watched a 6 hour course and used sololearn and this was never properly explained. You explained perfectly. I commend you

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

      You definitely saw Mosh classes

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

      i know the sololearn pain

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

      @@mysteri0us_998 they give you a pretty decent framework, but the application isnt taught well imo

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

      @@brodycates8472 ok

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

      i can understand i couldnt understand object oriented programming , generators and stuff from that course

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

    For the reverse I used range and gotten the same result which is pretty cool. Code:
    for i in range(5,0,-1):
    for j in range(i):
    print("# ", end="")
    print()

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

      I used this:
      x=4
      while x>0:
      for i in range(x):
      print('# ',end="")
      print()
      x-=1

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

      @@sriabhirammuthadi4249 smort 🗿

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

    Awesome...
    Better than paid courses...

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

    #Solution for 2nd problem
    for i in range(4):
    for j in range(4):
    if(i

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

      Nice thinking

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

      good work

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

      How to work this code plz understand me how to implement this logic plz help me🤔🤔

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

      You are intelligent ❤

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

      Very good.....

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

    Dear Sir. This is a very valuable series. I got the same result with below code.
    for i in range(4, 0, -1): # starting each row from the heighest size
    for j in range(i): # Printing each column inside each row according to row size
    print("#", end="")
    print() # Printing a new line to start a new row
    Please do more stuff like this. Respect from a SriLankan..............!!!!

  • @sarthakagrawal7443
    @sarthakagrawal7443 3 ปีที่แล้ว +36

    1).
    for i in range(4):
    for j in range(i+1,5):
    print(j, end="")
    print()
    2).
    s1="ABCD"
    s2="PQR"
    for i in range(4):
    print(s1[0:i+1]+s2[i:])

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

      thanks dude , its nice logic . how did u come up with this idea

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

      s1[(0:i+1)]+s2[i:] ye thoda samjha do pls

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

      @@subhashis3675 It states the indexing for printing : s1[(indexing start:ending index number]. So first strings indexing starts from 0 and ends in i+1. The second start from i and end in the last index number. I hope you understand this :)

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

    Answers:
    Asgn1:
    for i in range(1,5):
    for j in range(i,5):
    print(j,end=" ")
    print()
    Asgn2:
    x='ABCD'
    y='PQR'
    for i in range(4):
    print(x[:i+1]+y[i:])

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

      can yo please explain this 2nd assingment logic use in print

    • @afrozkhan.
      @afrozkhan. 4 ปีที่แล้ว

      @@alisabir2440 Debug the program
      Or
      write that print statement in idle
      U will understand....

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

      I actually don't understand it I did debug but that print statement I get confused

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

      what will be the code for asgn 1 if the pattern is in reverse order

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

      @@akshaypathak8280 for i in range(1,5):
      for j in range(5-i,5):
      print(j,end=" ")
      print()

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

    The reason for learning this explained in 45 seconds. This is hat I have found gold with Navin's videos, in addition the the solid walk through.

  • @PiyushSharma-hy2ej
    @PiyushSharma-hy2ej 6 ปีที่แล้ว +22

    1st pattern:==>
    for i in range(1,5):
    for j in range(1,5):
    k=i+j-1
    if k>4:
    print("",end="")
    else:
    print(k,end="")
    print()
    2nd pattern:==>
    x='ABCD'
    y='PQR'
    for i in range(1,5):
    print(x[:i]+y[i-1:])

  • @DarkKnight-dc9gr
    @DarkKnight-dc9gr 4 ปีที่แล้ว +12

    1)
    for i in range(1,6):
    for j in range(i,5):
    print(j,end="")
    print()
    2)
    s1="ABCD"
    s2="PQR"
    l=len(s1)
    for i in range(0,4):
    for j in range(i+1):
    print(s1[j],end="")
    for k in range(i,3):
    print(s2[k],end="")
    print()

  • @AnkushMalode10
    @AnkushMalode10 3 ปีที่แล้ว +39

    1)
    for i in range(4):
    for j in range(4-i):
    print (i+j+1,end=' ')

    print()

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

    #1
    For i in range (1,5):
    For j in range (i,5):
    Print(j,end="")
    Print()
    #2
    a="ABCD"
    b="PQR"
    for i in range (4):
    For j in range (3):
    Print(a[0:i+1],end="")
    Print(b[i:j+3],end="")
    Break
    Print()

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

      @jssriharijaikumar7473 Yes, I also want to know the logic behind this.

    • @RAJKUMARK-rj7yx
      @RAJKUMARK-rj7yx ปีที่แล้ว

      @@SarbajitDey @jssriharijaikumar7473 range function always starts at 0 . That's why the j value remains 0 till the end of the loop

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

      I think there is no need for j in the sixth line just i:3 is fine and this solution have no blank space in a and b list. I have a better one:
      a = "APQR"
      b = "ABCD"
      for i in range(4):
      for j in range(i+1):
      print(b[j], end=" ")
      for k in range(j, 3):
      print(a[-(3-k)], end=" ")
      print()

    • @imissedthepartwherethatsmy9305
      @imissedthepartwherethatsmy9305 10 หลายเดือนก่อน

      ​@@boyanghu1222bro that's so clever
      Can u please tell me how to reach this level of reasoning
      Does it come with practice or do I have to be gifted to crack it
      Please respond if possible

    • @boyanghu1222
      @boyanghu1222 10 หลายเดือนก่อน +1

      @@imissedthepartwherethatsmy9305 Hey bro, thanks very much for the appriciation! But unfortunately I was just an amatuer, who studies Python for his research paper. However what I want to tell you is that, first of all you must know the fundamental knowlege very well and remember them deeply. And then do more practical exercises. This level is not that difficult to reach. By the way, I have learned Python on and off for about more than half a year.

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

    Navin, you saved me. I owe you, sir. You don't know that you are my guide.

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

      and, now he knows it 🙂🙂.

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

    Trust me it's much better than any paid course's . Truely appreciable work. Thanks sir for giving such type of knowledge 🙂

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

    I'm a beginner.I liked the way he teaches. Started watching his videos in the morning 11 a.m and now reached 21st video by this time on the very same day. wonderful job sir.Nobody can teach the way he teaches.

  • @nikhilpn764
    @nikhilpn764 3 ปีที่แล้ว +28

    1.for i in range(1,5):
    2. for j in range(i,5):
    3. print( j , end=" ")
    4. print()

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

      i dont understand the second print, whats that for?

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

      @@almirkazaferovic4041stands for new line

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

      @@_harshasgowda_ tq brh 😜

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

    Now I am getting this in my brain exactly just one day before my exams but now I am understanding every point and now I am gaining some confidence and if I will be practising this type of things ,my logic building will increase .

  • @NarenderKumar-tp3bg
    @NarenderKumar-tp3bg 4 ปีที่แล้ว +7

    Third pattern can also be drawn in thus way also:
    For i in range(4,0,-1):
    For j in range(i):
    print('*',end=" ")
    print()

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

    Answers for 1st and 2nd:
    for i in range(5):
    for a in range(4-i):
    print(a+1+i,end='')
    print()
    😑2nd one:
    a,b="ABCD","PQR"
    for i in range(4):
    print(a[:i+1]+b[i:])
    Thank you SIR 😊

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

    solution for second is
    a="ABCD"
    b="PQR"
    for i in range (4):
    print(a[:i+1]+ b[i:])

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

    From Tamilnadu, Thanks a million to you to explain in such a great way.
    Love you brother Navin reddy, Now a days addicted to watch about your python videos

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

    You are a very good and passionate teacher. Indian people are the best in programming! Greetings and respect from Rome, Italy.

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

    FOR 1st pattern
    for i in range(5):
    for j in range (4-i):
    print(j+i+1,end =" ")
    print()

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

    By far the best technical teacher I have seen. Navin, keep your passion for technology and teaching going. You have a gift and you are a gift!

  • @mysteri0us_998
    @mysteri0us_998 3 ปีที่แล้ว +7

    the answer to the third one can be simplified as:
    for i in range(4):
    print("#"*(4-i))
    easy

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

      in the exam they'll ask fr nested loop

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

    I have started learning Python using this course and I can tell it is simply amazing! Thank you Navin! Short videos which are all easy to follow is the key of success of this course. I love it.

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

    x = int(input("enter no or rows"))
    for i in range(x):
    for j in range(x-i):
    print(j+i+1, end=" ")
    print()
    came late, but had fun.
    Also I noticed for the same code in 5:45, My pattern is flipped upside down(which you reversed btw(which when i tried got you first pattern)). Do you think this is because of the updated pycharm versions.

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

      I used
      t=-1
      for i in range(4):
      t=t+1
      s=t
      for j in range(4-i):
      S=S+1
      print(s, end="")
      Print()

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

    Sir, Print triangle patterns it can also write 👇
    For j in range (1,5):
    For i in range (i):
    Print ("#",end="")
    Print()

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

      for i in range(4):
      print("# " * 4)

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

    for i in range(1, 5):
    for j in range(i, 5):
    print(j, end=" ")
    print()

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

    2)
    x,y='ABCD','PQR'
    for i in range(4):
    print(x[:i+1]+y[i:])

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

    a=['A','B','C','D']
    b=["P","Q","R"]
    for i in range (4):
    for j in range(4):
    if j

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

    for any number:
    x=int(input('enter number'))
    for i in range (x):
    for j in range (i,x,1):
    print(j+1,'',end='')
    print()

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

    # for assignment quest1
    for i in range(1,6,1):
    for j in range(1,6-i,1):
    print(j,end="")
    print()

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

      ans for ass 1:
      for i in range(0,5,1):
      for j in range(1+i,5,1):
      print(j,end="")
      print()

  • @shivammishra310
    @shivammishra310 3 ปีที่แล้ว +20

    for j in range(1,5):
    for i in range(j, 5):
    print(i, end=" ")
    print()
    sir my answer is this.

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

    for i in range(rows):
    for k in range(rows):
    if k >= i:
    print('#', end = '')
    print('
    ')

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

    for i in range(4):
    for j in range (4-i):
    print(i+j+1,end="")
    print()
    thanks for such a wonderful course for free sir

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

    2)Prob
    str1 = ('APQR')
    str2 = ('ABCD')
    for i in range(1):
    print(str1,end="")
    print()
    i=str1.replace("P", "B")
    print(i,end="")
    print()
    j=i.replace("Q","C")
    print(j,end="")
    print()
    print(str2)

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

      Thanks

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

      Correct..but 1 mistake..at 9th line str1 = I would come

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

    solution for the first ques
    for i in range (1,5):
    for j in range(5-i):
    print(i+j ,end= "")
    print()

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

    How colleges dont license this dude is beyond me, in depth explanation barney style, thank you for taking the time to do this.

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

    Much more easy and worth-fame version of "Printing Patterns". 100% sure, it is an under-rated channel. Well-appreciated your work, sir!

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

    Naveen Sir, You have a wonderful way of teaching..I will always remember you for the change you have made in my life. Learning any Programming language was always so boring and challenging task for me but now I always look forward to your python series as I find it very easy and interesting. God bless you, Sir!

  • @hshhsh7172
    @hshhsh7172 3 ปีที่แล้ว +9

    Answer for 1st qst:
    for j in range(0,5):
    for i in range(j+1, 5):
    print(i, end="")
    print()

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

    @ 04:24
    we can use only one for loop for similar kind of values.
    1) for i in range(4):
    print("* " * 4)
    o/p :
    * * * *
    * * * *
    * * * *
    * * * *
    2) @ 5:42
    row = 4
    start_point = 1
    for i in range(row):
    print("* " * start_point)
    start_point += 1
    o/p :
    *
    * *
    * * *
    * * * *

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

    # Problem1 solution
    for i in range(1,5):
    count=i
    for j in range(5-i):
    print(count, end='')
    count += 1
    print('')

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

    These sessions are really well articulated and explained to a newbie!

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

    for i in range(4):
    print("#"*4)
    this also work

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

    Great Teacher I got in TH-cam ,the best part you have mention "we don't teach we educate" it is actual true , I really enjoy your videos ,Thanks for teaching thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

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

    answer of question no.2
    for i in range (4):
    for j in range (4):
    if (i

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

    Alternate way of printing second pattern:
    a=('# ')
    for i in range (1,5):
    print(i*a,end='')
    print()

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

    Bro you are just awesome! you made learning python so easy, your energy level and presentation is so good

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

      If you understand in a batter way..
      Can u help me out
      I am getting an error msg in
      print("#",end="")
      print("#",end="")

    • @arunrajak.b9170
      @arunrajak.b9170 4 ปีที่แล้ว +1

      @@letsviraltoday add a print() in last line if you use end=" "

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

      @@arunrajak.b9170 thank u

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

    Ultimate teacher, don't know how to pay gratitude... Sir, better than any paid course... 🥰

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

    for j in range(1,5):
    print(j, end="")
    i = j+1
    while i

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

    (1)
    string = '1234'
    for i in range(len(string)):
    print(string[i:])
    (2)
    string1 = 'APQR'
    string2 = 'ABCD'
    for i in range(len(string1)):
    string1 = string1.replace(string1[i], string2[i])
    print(string1)

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

      Bro can u plz tell the meaning of statement
      print(string[i:])
      Actually i not getting the meaning of [i:]

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

      @@ishaningale4360 i value will be incremented each time and range will also chnages. At first i=0 and [i:] means i value to end of list, When i is 0 it will print 1234 after that i will be increment to 1. so here [i:] means [1:] it will print values from first index to end so here it will print 234 and it goes on

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

      Awesome Malik Sir..Great Work using only String makes a program very Simple.

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

    2nd Problem:
    a = ('A','B','C','D')
    b = ('P','Q','R')
    for i in range (4):
    for j in range (4):
    if i>=j:
    print(a[j],end ="")
    else:
    print(b[j-1],end ="")
    print()

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

    I can feel my brain get LARGER!

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

      @lakshmi prasanna At the end of the vid..

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

      @lakshmi prasanna hey where you find the assignment I am also struggling to find the assignment if you know please tell me

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

      @@bluemeet8546 7:42 just pause vha dikh jayega top

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

    Navin Reddy, I am watching you from Pakistan for a year. You improved my skill a lot. now I know that you are watching my comment, can I have a heart from u

  • @snehalKonda
    @snehalKonda 8 หลายเดือนก่อน +1

    1st Assignment:
    for j in range(1,5):
    for i in range(j,5):
    print(i,end="")
    print()
    2nd Assignment:
    i="ABCD"
    j="PQR"
    for l in range(1,5):
    print(i[0:l]+j[l-1:len(j)])

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

    Ur debugging part is the best visualisation i have ever seen. Thank you for putting such an effort in this course.

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

    your teaching style is really different from others and you are awesome . keep teaching like this you are crushing it through your coarse.

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

    Sir you are the best.
    All courses are nothing before your videos.
    Salute you sir.
    Because of you now I'm the best python programmer in my class.

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

    code for 1st assignment:
    for i in range(1,5):
    for j in range(i,5):
    print(j,'',end='')
    print()

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

    solution1st:
    for i in range(4):
    for j in range(i,4):
    print (j+1,end="")
    print()
    solution 2nd:
    chr='ABCDPQR'
    for i in range(4):
    print(chr[0:i+1],end="")
    print(chr[4+i:7]

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

      In ur second solution exactly at 4th line why is that indexing is 7 ?

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

      @@vishnupriyam2926 because there are 7 characters 'ABCDPQR' for position 0 to 6 . so when you give the end point at 7 it actually access the sixth character as the final character.

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

    this guy is so good and the course is free oh my days. Learned so much from you thanks so much

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

    for j in range(5):
    for i in range(j+1,5):
    print(i,end="")
    print()
    For 1st pattern

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

    for i in range(4,0,-1):
    for j in range(i):
    print('#',end='')
    print()

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

    for k in range(4):
    print('# '*4)
    --- > This will do for creating the square

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

    This is way better than some paid courses. Thank you Navin Sir. :)

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

    For Question 2:
    This will be a generic solution where str1 and str2 can be replaced by any characters irrespective of the length of the strings.
    str1="ABCD"
    str2="PQR"
    i=0
    while i < len(str1) :
    for j in range(0,i+1):
    print(str1[j],end=" ")
    for k in range(i,len(str2)):
    print(str2[k],end=" ")
    i+=1
    print()

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

    for j in range(1,5):
    for i in range(5-j):
    print(i+j, end="")
    print()

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

    for j in range(4):
    for k in range(4-j):
    print(j+k+1, end='')
    print()

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

    All the three patterns can be done using one loop:
    1) for i in range(5):
    print('#'*5)
    2)for i in range(5):
    print('#'*i)
    3) for i in range(6,1,-1):
    print('#'*i)

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

    str="1234"
    for i in range(4):
    print(str[i:])

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

      Bro explain this maan

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

      Explain b krdo

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

      it was cool bro

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

      @@ektadhapola9698
      i = 0 str[0:] 1234
      i = 1 str[1:] 234
      ..
      .
      str[start_limit:end_Limit]

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

      it's a Greattt solution..!! ;)

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

    That's really fantastic master. Currently my platform is uipath but I have interest to learn more technologies. So finally I decided to learn python. So in that TH-cam is doing much favor the guys who want to learn anything. So in that you crated a good platform to learn a python such a easy way and very logically. Thank you very much Master. Finally my conclusion is in any schools, colleges and any where the persons who are being like you then every one will became a great learner and they will reach their goal.

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

    Tomorrow I have an interview, Thank you sir for all these videos these lectures are better than any paid course or coaching.

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

    Assignment1:
    for i in range(1,5):
    print(i,end="")
    for j in range(1,5-i):
    print(i+j,end="")
    print()

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

      cool answer bro, thanks

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

      Another alternative :- for the 1st assignment:-
      num1 = '1234'
      for i in range(4):
      print(num1[:4-i] and num1[i-4:])
      print()

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

    For perfect square pattern i.e 1
    for i in range(4):
    print('# ' *4)
    It'll work definitely

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

    Great explanation. I was able to simpify this even more using the following:
    for i in range(4):
    print("# " * 4)
    for i in range(4):
    print("# " * (i+1))
    for i in range(4):
    print("# " * (4-i))

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

    for i in range(4):
    j=1
    while j

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

    # Print reverse triangle of range(4)
    for i in range(4):
    for j in range(4-i):
    print(i+j+1, end='')
    print()

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

      bro i wanna ask why the print() is putted in the end of code? cuz i tried and it was so important but i dont get why

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

      @@juscoding it's for new line ig

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

      @@vipusingh8584 yeah that was the reason, thanks

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

    Sure this guy will take my big, I mean big pocket soda when I reach him out, I pledge to touch a life like he has done to me. will mentor whole good individuals courtesy of Neveen and the team.

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

    Amazing Series Navin Sir, thoroughly enjoyed it.Kudos!

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

    Q1. print pattern
    for i in range (1,5):
    for j in range (i,5):
    print(j, end="")
    print()

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

    1st PATTERN:
    for i in range(1,5):
    j=4
    for j in range(i,j+1):
    print(i,end="")
    i+=1
    print()

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

      Print(j,end="")
      Not i
      😁

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

    love the python series... must compliment you on creating such consistently amazing content... just a small observation, for the last example, would reversing the outside loop have created a more intuitive code?

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

    Question 1:
    str1='ABCD'
    str2='PQR'
    for i in range(4):
    print(str1[ : i+1 ] + str2[ i : ])
    Question 2:
    for i in range(5):
    while i

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

    row=int(input("enter the no of row "))
    j=row
    while j>=1:
    for i in range(j):
    print("#",end=" ")
    print()
    j=j-1

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

    for i in range(1, 5):
    print(i * "#")

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

    I spent so much time on that much at last, i made it
    for i in range(5):
    for j in range(i+1,5):
    print(j,end="")
    print()
    1234
    234
    34
    4

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

    I am watching this course 2 yrs after the date it was uploaded but it still seem to be up to date. Awesome teacher and very well explained. Can watch your videos whole day. Thx for this course and for helping us learn.👍👍👍👍

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

    Q1)
    a, b = 1, 5
    for j in range(1, 5):
    for i in range(a, b):
    print(i, end=" ")
    a += 1
    print()

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

    For second pattern
    for i in range(1,5):
    Print('#'*i,end=' ')
    Print()
    This is more efficient sir😁

    • @ShivamKumar-rz7uv
      @ShivamKumar-rz7uv 2 ปีที่แล้ว

      For a in range (5)
      print('*' * a)
      Done
      🙃👍

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

    It can also be done in this way
    for i in range(4):
    print("#"*4)

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

      and way better optimised

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

      Cool

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

    #Both solutions are written in a program below
    #1
    for i in range(5):
    for j in range(4-i):
    print(i+1,end='')
    i+=1
    print()
    #2
    li='ABCD'
    lj='PQR'
    for i in range(4):
    chi=li[0:i+1:]
    chj=lj[i::]
    print(chi+chj)

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

      Could you please explain the code for Q 2

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

    for i in range(4):
    for j in range (4):
    if i

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

    finally understood what is happening in the pattern code

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

    for i in range (4):
    print("#"*4)
    it worked

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

    for i in range(4):
    print(("# "*4))