A program that takes user input and draws pattern of astrologer's stars




while True:
    try:
        print("How many rows of stars you want?")
        nr = int(input())
    except:
        print("Wrong input! Only numbers allowed.")
        continue

    print("""Keys:
    Just press Enter for inverted pattern or
    Type anything and press Enter for upright pattern.""")
    tf = bool(input())

    i=0
    if tf == True:
        while i<nr:
            print("*"*(i+1))
            i+=1

    else:
        while i<nr:
            print("*"*(nr-i))
            i+=1





Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

What is the difference between iostream and iostream.h in cpp?

The Basic Structure of a Full-Stack Web App