Make Your name-pattern Program using Python.


Make Your name-pattern Program using Python.



Hello everyone Today we are sharing a pattern program using Python.

this program lets you print your name in a pattern style.
So without Wasting Let's get Started.

Program:


str="Mr Advance Technical"
for i in range(len(str)+2):
    for j in range(i):
         if(j==i-1):
             print(str[:j])
         
Output:
Name-Pattern Program using Python


Explanation: here we have stored a name in str variable. the First loop will iterate till the String length and the second(inner) loop will follow the first loop. and the print function will print the characters of the String each time. till the inner loop gets Termination.     
  • and the entire string will be print till the j length at every iteration of the loop. 
  • so for all character we have set first parameter as empty and second parameter will be up to j of length [:j]


Note: the iteration Will be start from 0 and the last number will not be Considered By for so we have used len(str)+2.  

So that's it for today.

Thank you.

No comments: