1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vlada-n [284]
3 years ago
10

Consider the series of alternating 1s and 0s 1 0 1 0 1 0 1 0 1 0 ...... The user will enter a number n . And you have to output

the first n numbers of this sequence (separated by spaces) You may assume the user will enter n > 0 and an integer using two if statements

Computers and Technology
1 answer:
Vika [28.1K]3 years ago
8 0

Answer:

# user is prompted to enter the value of n

n = int(input("Enter your number: "))

# if statement to check if n > 0

if (n > 0):

   # for-loop to loop through the value of n

   for digit in range(1, (n+1)):

       # if digit is odd, print 1

       if((digit % 2) == 1):

           print("1", end=" ")

       # else if digit is even print 0

       else:

           print("0", end=" ")

Explanation:

The code is written in Python and is well commented.

A sample output of the code execution is attached.

You might be interested in
A _is a short descriptive label that you assign to webpages, photos,
Nitella [24]
Looks like you already answered your question? It’s the a tag ()
5 0
3 years ago
What refers to a pleasing arrangement of colors that creates a sense of balance or equilibrium in an image? _____ refers to a pl
Nina [5.8K]

Answer:

The word is " Harmony"

In Art, Harmony is the balance. It is one of the seven principles of Art.

It is the delightful way the  parts are organised, which creates a balanced view, the “Visual equilibrium” .

Harmony is in the music, poem, colours and  even in the  food. Balance give us a pleasant  feeling of equilibrium.

8 0
3 years ago
Read 2 more answers
Please Help Me!!! 40 Points!! Match the correct definition to each term
fgiga [73]

Answer:

is there anymore to this problem because I would like to help you out more mate.

6 0
3 years ago
Which kind of results will appear using the search query "Frosty the Snowman" in quotation marks?
Citrus2011 [14]
The correct Answer is B
6 0
3 years ago
Calories, sugars, and total fats could exceed the declared calorie value on the menu by only what percentage?
zysi [14]

Answer:

20

Explanation:

3 0
3 years ago
Other questions:
  • What can you look for on a website to indicate that the information it presents is reliable?
    15·1 answer
  • Xml is used to format the structure and style of a web page. true or false
    7·1 answer
  • Write an expression that evaluates to true if and only if the value of the integer variable workedOvertime is true.
    7·1 answer
  • I need help <br> Match each words with its definition!!!<br> Please helpppppppp
    12·1 answer
  • Which feature enables you to make changes to all the slides of your presentation at the same time?
    15·2 answers
  • 4.5 code practice computer science
    5·1 answer
  • Why is John Von Neumann to a remarkable name?<br>si​
    15·1 answer
  • The ideal body position for your legs after you've adjusted your seat is with your knee ___.
    8·1 answer
  • This unintelligent brain of mine decided to charge my phone overnight thinking that nothing bad will happen ;-; the next morning
    11·1 answer
  • A DSS8440 server is equipped with one power supply that is failing and requires replacement. What is the correct sequence of ste
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!