Q. Write a function called print_pattern that takes integer number as argument and prints the following pattern.
If the input number is 3.
*
* *
* * *
If input is 4, then it should print:
*
* *
* * *
Answer =
def print_pattern (x) : for i in range (1, x + 1) : print (i * "*") num = int (input ("Enter the number : - ")) print_pattern (num)
Output :-
Enter the number : - 3
*
**
***
>>>
*
**
***
>>>
Enter the number : - 5
*
**
***
****
*****
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )