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
Please help me with these two questions! 60 points!
RUDIKE [14]

Answer:

Networks prevent unauthorized access to data and protect equipment. Networked computers are less likely than single computers to suffer equipment failure. Networks allow computers to connect quickly and to share data or equipment.

Explanation:

3 0
2 years ago
Which symbol should you use for entering a formula in a cell?
Sonbull [250]

A symbol which should be used for entering a formula in a cell is: B. =.

<h3>What is Microsoft Excel?</h3>

Microsoft Excel can be defined as a software application that is designed and developed by Microsoft Inc., for analyzing and displaying spreadsheet documents by using rows and columns in a tabulated format.

<h3>What is a spreadsheet?</h3>

In Computer technology, a spreadsheet can be defined as a document which comprises cells that are arranged in a tabulated format with rows and columns. Also, a spreadsheet is typically used in various field to do the following on a data:

  • Sort
  • Calculate
  • Format
  • Arrange

As a general rule, "B. =" is a symbol which should be used for entering a formula in a cell on a spreadsheet application such as Microsoft Excel.

Read more on spreadsheets here: brainly.com/question/4965119

#SPJ1

3 0
1 year ago
In javascript, what can I put after player. to make my character go in the center of the screen? like example:
melamori03 [73]

Answer:

0,0

Explanation:

you could try to use the x-axis and y-axis to put your character in a certain place. I'm not totally sure if that is how javascript works, but for the x-axis and y-axis, the center is always(0,0).

6 0
3 years ago
List five things that could cause premature bearing failure
Wewaii [24]
Smoking, Drinking, Use of drugs, problems with uterus, Problems with cervix or placenta.


6 0
2 years ago
Thomas Edison and his assistant W. K. L. Dickson patented which device in 1891
Svetlanka [38]
They patented the kinetoscope
5 0
2 years ago
Read 2 more answers
Other questions:
  • Smartart and shapes are useful tools because they allow you to
    10·1 answer
  • 1.
    5·2 answers
  • John works for Internal Computer Specialists, which focuses on helping small business owners resolve MIS infrastructure issues.
    12·1 answer
  • Using features on demand results in saving potentially significant amounts of disk space. features on demand becomes a third ins
    14·1 answer
  • What is another term for technology?
    12·1 answer
  • Do you think the current system of punishment in the United States works? Why? What would you change?
    13·1 answer
  • Select the correct answer.
    5·2 answers
  • What does the binary odometer show about representing large numbers​
    15·1 answer
  • Disrupting a business's ability to conduct electronic commerce is cönsidered an act of
    6·1 answer
  • In order to detect repeated lines anywhere in the input, myuniq must keep track of all of the lines it has seen as it moves thro
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!