Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

#23 Python Tutorial for Beginners | Printing Patterns in Python

1.4M views on YouTube

Check out our courses:

Agentic AI Engineering with Python : https://go.telusko.com/agentic-ai-python
Coupon: TELUSKO10 (10% Discount)

Master Java Spring Development : https://go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)

For More Queries WhatsApp or Call on : +919008963671

website : https://telusko.com/

Udemy Courses:

Java Spring:- https://go.telusko.com/Udemyjavaspring
Java:- https://go.telusko.com/udemyteluskojava
Spring: https://go.telusko.com/udemyteluskospring
Java For Programmers:- https://go.telusko.com/javaProgrammers
Python : https://go.telusko.com/udemyteluskopython
Git : https://go.telusko.com/udemyteluskogit
Docker : https://go.telusko.com/udemyteluskodocker

Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
WhatsApp : https://go.telusko.com/whatsapp
Discord : https://discord.gg/D8hWe9BqfF

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 : https://www.youtube.com/watch?v=hEgO047GxaQ&t=0s&index=2&list=PLsyeobzWxl7poL9JTVyndKe62ieoN-MZ3
Python Tutorial in Hindi : https://www.youtube.com/watch?v=JNbup20svwU&list=PLk_Jw3TebqxD7JYo0vnnFvVCEv5hON_ew

Github :- https://github.com/navinreddy20/Python-

In this video we will see:
– Printing patterns
– Using loop
– For loop

Python for Beginners :- http://bit.ly/3JOLQhl

Editing Monitors :
https://amzn.to/2RfKWgL
https://amzn.to/2Q665JW
https://amzn.to/2OUP21a.

Editing Laptop :
ASUS ROG Strix – (new version) https://amzn.to/2RhumwO

Camera : https://amzn.to/2OR56AV
lens : https://amzn.to/2JihtQo

Mics
https://amzn.to/2RlIe9F
https://amzn.to/2yDkx5F

Java:- https://bit.ly/JavaUdemyTelusko
Spring:- https://bit.ly/SpringUdemyTelusko

More Learning :

Java :- https://bit.ly/3x6rr0N
Python :- https://bit.ly/3GRc7JX
Django :- https://bit.ly/3MmoJK6

JavaScript :- https://bit.ly/3tiAlHo
Node JS :- https://bit.ly/3GT4liq

Rest Api :-https://bit.ly/3MjhZwt
Servlet :- https://bit.ly/3Q7eA7k
Spring Framework :- https://bit.ly/3xi7buh
Design Patterns in Java :- https://bit.ly/3MocXiq
Docker :- https://bit.ly/3xjWzLA

Blockchain Tutorial :- https://bit.ly/3NSbOkc
Corda Tutorial:- https://bit.ly/3thbUKa
Hyperledger Fabric :- https://bit.ly/38RZCRB

NoSQL Tutorial :- https://bit.ly/3aJpRuc
Mysql Tutorial :- https://bit.ly/3thpr4L

Data Structures using Java :- https://bit.ly/3MuJa7S
Git Tutorial :- https://bit.ly/3NXyCPu

Donation:
PayPal Id : navinreddy20
https://www.telusko.com