w3resource

Python Exercise: Construct the following pattern, using a nested loop number

Python Conditional: Exercise - 44 with Solution

Write a Python program to construct the following pattern, using a nested loop number.

Pictorial Presentation:

Python Exercise: Construct the following pattern, using a nested loop number

Sample Solution:

Python Code:

# Iterate through a range from 0 to 9 (excluding 10)
for i in range(10):
    # Print the string representation of 'i' multiplied by 'i'
    print(str(i) * i)
	

Sample Output:

1                                                                                                             
22                                                                                                            
333                                                                                                           
4444                                                                                                          
55555                                                                                                         
666666                                                                                                        
7777777                                                                                                       
88888888                                                                                                      
999999999     

Flowchart :

Flowchart: Find the multiplication table of a number

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to create the multiplication table (from 1 to 10) of a number.
Next: Python functions Exercises

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://198.211.115.131/python-exercises/python-conditional-exercise-44.php