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
Question 18
beks73 [17]

Answer:

None

Explanation:

Logical operators:

'and' indicates that the statement is true if both conditions are true.

'or' indicates that the statement is true if one or both conditions are true.

Given that a = 1 and b = 10:

The first statement is false (1×10 <= 1 is false, 1 >= 10 is also false)

The second statement is false (1>10 is false, a does not equal b)

The third statement is false (a does not equal b)

None of these statements are true.

Hope this helps :)

8 0
3 years ago
Your users are calling the help desk, complaining that they are constantly losing work they have done on a document in Word. How
Natalka [10]

Listen to the story of what every had happening evaluate after learning what was happening to everyone, try to solve the problem.


Im not to sure how to explain this.

3 0
3 years ago
Read 2 more answers
To open the find and replace dialog box with shortcut keys, hold down ctrl and press ________
ratelena [41]
Hi. To open the find and replace dialog box with shortcut keys, hold down CTRL and press the letter "H". 

Hope this helps.
Take care.
8 0
3 years ago
Type the numbers 1-50 and then type Computers and Technology twice type it once forward and once backwards.
Ierofanga [76]

Answer:

Why?

Explanation:

7 0
3 years ago
Read 2 more answers
How does the team know what to work upon during the iteration? (1 correct answer)
andrezito [222]

Answer:

2

Explanation:

In iteration, the entire team participates. A list of backlog and upcoming tasks is made and plan for the execution of these tasks is decided mutually.

6 0
3 years ago
Other questions:
  • ___________ is an unsecured client server application / protocol that transfers files between two computers.
    11·1 answer
  • The company database may be stored on a central database server and managed by a database adminstrator true or false
    12·1 answer
  • You need a collection to represent secret agents. Every agent has a unique codename that identifies them, and an Agent object th
    14·1 answer
  • Why hasn’t the World Health Organization declared a global health emergency?
    5·1 answer
  • Practice with CSS. a. Write the CSS for an HTML selector footer with the following characteristics: a light-blue background colo
    11·1 answer
  • Which step is done first to replace existing text in a text box?
    10·2 answers
  • What does the following if statement do?<br><br> if (num1 == Math.abs(num1))
    12·1 answer
  • C. Compare Mainframe and Minicomputers with their key features<br><br><br><br>plzzz help ​
    12·1 answer
  • Technology is (BLANK.1 ) science that makes (blank.2) science useful and practical.
    7·2 answers
  • True or False? Any edition or version of Windows can join a domain.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!