Python Exercise 4: Astrologer's Stars

Code file as described in the video

# Exercise 4
# Pattern Printing
# Input = Integer n
# Boolean = True or False
#
# True n=5
# *
# **
# ***
# ****
#
# False n=5
# ****
# ***
# **
# *
  


Comments(3)

charzo at 2019-06-23 09:30:09 says
print("Please enter the number of row(s) you want to print ") given_row=int(input()) print("Enter 'Yes' for Top to Bottom and 'No' for Bottom to top style") print_style=input().lower() #If we typecast any string to Boolean , it will be always "True", so typecasting an input() to boolean is difficult I found. if print_style=='yes' : print_style=1 elif print_style=='no': print_style = 0 else: print("Invalid Input") def top_to_bottom(row_num): row_flag=1 while(row_flag<=row_num): print_flag = 1 while(print_flag<=row_flag): print(" * ",end="") print_flag=print_flag+1 row_flag=row_flag+1 print("\n") def bottom_to_top(row_num): row_flag=1 while(row_flag<=row_num): print_flag = 5 while(print_flag>=row_flag): print(" * ",end="") print_flag=print_flag-1 row_flag=row_flag+1 print("\n") if(print_style): top_to_bottom(given_row) else: bottom_to_top(given_row)
charzo at 2019-06-23 09:30:09 says
Ignore it
charzo at 2019-06-23 09:30:09 says
I am trying to paste the code here , but it is getting messed up!!