Python Program to Print an Inverted Star Pattern | #pythonprograms

preview_player
Показать описание
Problem Description
The program takes a number n and prints an inverted star pattern of the desired size.

Problem Solution
1. Take a value from the user and store it in a variable n.
2. Use a for loop where the value of i ranges between the values of n-1 and 0 with a decrement of 1 with each iteration.
3. Multiply empty spaces with n-i and ‘*’ with i and print both of them.
4. Exit.

Program Explanation
1. User must first enter the value and store it in a variable n.
2. The for loop enables i to range between n-1 and 0 with a decrement of 1 with each iteration.
3. For each iteration, ” ” is multiplied with n-i and ‘*’ is multiplied with i to ensure correct spacing of the stars.
4. The required pattern is printed.

#Python Program to Print an Inverted Star Pattern
#Python Program to check prime number
#Python Program to print factorial
#Python Program to print sum of two numbers
Рекомендации по теме