You can watch this video lesson on Python Pattern Printing Programs to discover in-depth printing techniques for the star * in Z form.
You need to use two for loops in Python to print a star pattern in Z shape. The first for loop is in charge of the rows, while the second for loop is in charge of the columns. The reason we are using if else conditional statements is because we need to print stars in a specific pattern rather than in every row and column, which requires conditions. Here, logical and logical or operators are being used.
If you try to write this code in Python 2 you will receive an error since end cannot be used there and print is not a function in Python 2. To get the same result you must use print as a statement and a comma (,) at the end of the print statement.
In Python 3, you would type print as follows:
print("*',end="")
Python 2 requires that you type print "*",
#python #pythonforbeginners #pythonprojects #pythontutorial #pythonprogramming #ROYKNOX #CRVN #TheOtherSide
Song: ROY KNOX & CRVN - The Other Side [NCS Release] Music provided by NoCopyrightSounds Free Download/Stream: http://ncs.io/RKC_TOS Watch: http://youtu.be/
Thanks for watching!!
Subscribe Now For More Videos!!