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
domain controllers store local user accounts within a sam database and domain user accounts within active directory. true or fal
Natalka [10]

Answer:

True

Explanation:

The domain controller is a server that responds within windows server domains to request for security authentication. It enforces security for windows and they are useful for storing the account information of users, that is local users within a Security Account Manager. Therefore the answer to this question is true.

Thank you!

5 0
2 years ago
Critical Thinking Questions
nydimaria [60]
You’re profile is so cute hope this helps :)
5 0
2 years ago
What is an occupation?​
LiRa [457]

Answer:

a job or profession.

4 0
3 years ago
Python exercise grade 10
Lemur [1.5K]

nums = []

while True:

   num = float(input("Enter a number: "))

   if num <= 0:

       break

   nums.append(num)

print("The largest number entered was",max(nums))

I wrote my code in python 3.8. I hope this helps.

5 0
3 years ago
Your boss asks you to transmit a small file that includes sensitive personnel data to a server on the network. The server is run
mel-nik [20]

Answer:

a. Telnet transmissions are not encrypted.

Explanation:

Indeed, since <em>Telnet transmissions are not encrypted,</em> all the information sent, and even the characters typed in the telnet console are sent in clear text.

This is a security issue, since any other device in the same network will receive a copy of the information (packets) sent. For default, all the devices, except for the server expecting to receive the information, will discard the packets. However it is easy to actively <em>listen </em>and keep those packets, wich will contain the information in plain text and human readable.

4 0
3 years ago
Other questions:
  • Which of the following for-loop headers results in equivalent numbers of iterations: A. for (int q = 1; q &lt;= 100; q++) B. for
    12·1 answer
  • Apple users tend to like the company and love its products. Apple has successfully nurtured this __________ component of its cus
    15·1 answer
  • Which of the following is a true statement?
    12·2 answers
  • The length property of the String object returns
    15·1 answer
  • In addition to telling you which programs are currently running, what other information does the task bar display
    10·1 answer
  • There are many modes of remote visual communication. which is the most common mode
    5·1 answer
  • An attacker gained remote access to a user's computer by exploiting a vulnerability in a piece of software on the device. The at
    14·1 answer
  • Question # 2 Multiple Choice The _____ method returns an integer between the two provided numbers. It can take the value of eith
    10·2 answers
  • Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. T
    11·1 answer
  • Complete the following sentence. <br> _______ is often used to solve riddles and puzzles.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!