Exercise


# Question :
## Pattern Printing ##

# Input :

# Integer n
# Boolean = True or False

# Expected Output :

# Given: True n=4
# Output:
# *
# **
# ***
# ****

# Given: False n=4
# Output:
# ****
# ***
# **
# *

# Solve Here :

r = int(input("Enter Row:\n"))
n = int(input("Enter Boolean 1/0:\n"))
b = bool(n)
if b:
for i in range(r):
print("*" * i)

else:
for a in range(r):
print((r-a) * "*")

Comments

Popular posts from this blog

MAP FILTER AND REDUCE FUNCTION IN PYTHON

Writing Appending to a File

Recursions: Recursive Vs Iterative Approach