Number Sequence – Python Program

Here I am back with a new challenge for you guys.

Lets try to create a logic sequence of number in Python. Look at the below image.

num_seq

Number Sequence

The above logic sequence is created using following keywords:

  1. List
  2. Nested For Loop
  3. Print (of course)

Try to analyze the above given data and create the sequence from your own.

Failed? Click More below to get the Solution…

Here is the solution. Python Code file is attached at the end of the article.

sol_numseq

Solution for Number Sequence

list=[]
for i in range(0,7):
 list.append(1)
 for j in range(1,i):
  list[j]=0
 print(list)

If you have any queries, more simplified programs or solutions then kindly comment below. Also you can Email me your doubts and queries related to program.

Thank You!

Attachment: Number_Sequence.py

Advertisements

5 thoughts on “Number Sequence – Python Program

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s