In this article will be showing you a Python program to print alphabet pattern M.
Find below full code access and live demo video.
This will be done by using FOR loop using RANGE function. Print letters in python is going to be article/video series where I will going to cover all A to Z Alphabets one by one.
Lets explore bit about FOR loop and RANGE function before jumping into Pattern programming:
The range() function accepts three arguments:
What is FOR loop?
A loop is a used for iterating over a set of statements repeatedly. In Python we have three types of loops for, while and do-while. In this tutorials, we will use for loop and the other two loops are covered in the separate tutorials.What is RANGE function?
Simply, the range() function makes it possible to generate a sequence of numbers between a given range. For example, you might want to print out (or use) a range of numbers from 0–9. Depending on how arguments are passed through the function, a user can determine where the series of numbers begins and ends.The range() function accepts three arguments:
- start — integer where the range starts.
- stop — integer before the sequence is to end.
- step — how to increment between each integer in the sequence.
Related:
- How to Print Alphabet A in Python?
- How to Print Alphabet B in Python?
- How to Print Alphabet C in Python?
- How to Print Alphabet D in Python?
- How to Print Alphabet E in Python?
- How to Print Alphabet F in Python?
- How to Print Alphabet G in Python?
- How to Print Alphabet H in Python?
- How to Print Alphabet I in Python?
- How to Print Alphabet J in Python?
- How to Print Alphabet K in Python?
- How to Print Alphabet L in Python?
- How to Print Alphabet M in Python?
- How to Print Alphabet N in Python?
- How to Print Alphabet O in Python?
- How to Print Alphabet P in Python?
- How to Print Alphabet Q in Python?
- How to Print Alphabet R in Python?
- How to Print Alphabet S in Python?
- How to Print Alphabet T in Python?
- How to Print Alphabet U in Python?
- How to Print Alphabet V in Python?
- How to Print Alphabet W in Python?
- How to Print Alphabet X in Python?
- How to Print Alphabet Y in Python?
- How to Print Alphabet Z in Python?
Please find below script:
alphabet_str = ""for row in range(0,7):#move in rowsfor column in range(0,7):#move in columnif (column == 1 or column == 5 or (row == 2 and (column == 2 or column == 4)) or (row == 3 and column == 3)):alphabet_str = alphabet_str + "*"else:alphabet_str = alphabet_str + " "alphabet_str = alphabet_str + "\n"print(alphabet_str)#output{codeBox}
0 Comments