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 serialized object is ________. an object represented as a sequence of bytes used to store the object's data in a file an objec
Readme [11.4K]

Answer:

an object represented as a sequence of bytes used to store the object's data in a file.

Explanation:

In Java programming, a serialized object is usually an object represented as a sequence of bytes used to store the object's data in a file and can be reverted back into a replica of the object.

4 0
3 years ago
Read 2 more answers
Your computer is configured to obtain an ipv4 address and dns server address automatically. what utility will help you to find t
dolphi86 [110]
Terminal commands - ifconfig or ipconfig on windows
7 0
3 years ago
what are Include the data on usage you gather from your interactions with friends or by listening to people on the radio or on T
borishaifa [10]

Answer:

This has happened many times. I am quite close to my friends. I once asked for making a wood baked Pizza at one of my friends’ houses. Unfortunately. He didn’t have the setup. I was feeling bad as well. However, to add to my relief, he didn’t say he will not make. He also didn’t say he didn’t have the oven. And those double negatives made me happy as I didn’t wanted my friend to take this pain as he had to give an exam after 2 days. However, he even didn’t said he will not order for it. And that double negative confirmed for us a pack of two wood baked pizzas with fountain Pepsi, an hour later. And I was very happy as my friend was able to fulfill the promise.

On TV as well, I have heard a lot of double negatives during NBA matches, and especially on the radio. However, I must say double negatives sometimes happen as certain people are very sensitive, they do not ever want to say no.

Explanation:

Please check the answer.

7 0
3 years ago
The physical address assigned each network adapter is called its ________.
zysi [14]
MAC address
....................
5 0
3 years ago
Online library catalogs can direct you to your closest library. (1 point)<br> True<br> False
Kitty [74]

Answer:

True

Explanation:

8 0
3 years ago
Other questions:
  • Maria found a cupcake recipe on a cooking blog. However, she would like to read comments and suggestions before she begins bakin
    6·2 answers
  • Which of the following STEM discoverers developed a new type of computer hardware?
    11·1 answer
  • If you do not want to keep a change made by the autocorrect feature, you can click the ____ button on the auto correction option
    12·1 answer
  • highlight the possible risks and problems that should be address during the implementation of information system process
    5·1 answer
  • Assume you are using the text's array-based queue and have just instantiated a queue of capacity 10. You enqueue 5 elements and
    13·1 answer
  • What is a web browser​
    9·1 answer
  • Direction: Read each item carefully and choose the letter of the correct answer. Write your answers on a separate sheet of paper
    12·1 answer
  • How to do or create a shepard tone using additive synthesis in Pure Data. Please help, desperate!!
    8·1 answer
  • This question involves the creation and use of a spinner to generate random numbers in a game. a gamespinner object represents a
    8·1 answer
  • In _________, the process requests permission to access and modify variables shared with others. a) entry section b) critical se
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!