Logo Pastebin.fr
Pastebin

Retrouvez, créez et partagez vos snippets en temps réel.

Azdd

# Ask for input
try:
    first_n = int(input("Enter first_n (>=1): "))
    last_n = int(input("Enter last_n (>= first_n): "))

    # Validate bounds
    if first_n < 1:
        print("Error: first_n must be at least 1.")
    elif last_n < first_n:
        print("Error: last_n must be greater than or equal to first_n.")
    else:
        # Print consecutive rows of stars
        for i in range(first_n, last_n + 1):
            print('*' * i)
except ValueError:
    print("Error: Please enter valid integers.")

Créé il y a 3 mois.

Rechercher un Pastebin

Aucun paste trouvé.