Consider the series of alternating 1s and Os 1010101010...... The user will enter a number n....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the series of alternating 1s and Os 1010101010...... 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 Note: You may only use concepts learnt so far. You are not allowed to use more advanced concepts such as string indexing/lists etc. Python 3.7.4 Shell File Edit Shell Debug Options Window Help Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license ()" for more information. >>> ==== RESTART: C:\Users\Student\Desktop\test.py Enter n: 5 10101 ============== RESTART: C:\Users\Student\Desktop\test.py Enter n: 7 1 0 1 0 1 0 1 >>> Enter n: 4 10 10 Enter n: 6 1 0 1 0 1 0 >>> | ======== RESTART: C:\Users\Student\Desktop\test.py RESTART: C:\Users\Student\Desktop\test.py ======= X Consider the series of alternating 1s and Os 1010101010...... 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 Note: You may only use concepts learnt so far. You are not allowed to use more advanced concepts such as string indexing/lists etc. Python 3.7.4 Shell File Edit Shell Debug Options Window Help Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license ()" for more information. >>> ==== RESTART: C:\Users\Student\Desktop\test.py Enter n: 5 10101 ============== RESTART: C:\Users\Student\Desktop\test.py Enter n: 7 1 0 1 0 1 0 1 >>> Enter n: 4 10 10 Enter n: 6 1 0 1 0 1 0 >>> | ======== RESTART: C:\Users\Student\Desktop\test.py RESTART: C:\Users\Student\Desktop\test.py ======= X
Expert Answer:
Answer rating: 100% (QA)
SOLUTION CODE IN PYTHON nintinputEnter n Takes input as integer for i i... View the full answer
Related Book For
Probability and Statistics
ISBN: 978-0321500465
4th edition
Authors: Morris H. DeGroot, Mark J. Schervish
Posted Date:
Students also viewed these programming questions
-
Consider the series of examples in this section concerning service times in a queue. Suppose that the manager observes two service times X1 and X2. It is easy to see that both f1(x) in (9.2.1) and...
-
Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[1]. Then find the second smallest element of A, and exchange it with A...
-
A double-glazed window has two panes of glass separated by an air space, Fig. 14-20. (a) Show that the rate of heat flow through such a window by conduction is given by where k1, k2, and k3 are the...
-
One reason you might choose to sync a SharePoint library to your computer is to Select an answer: have a separate copy that your colleagues can't affect have a separate copy in case SharePoint breaks...
-
Suppose that f(x) g(x) = 1 for all and Prove that Does not exist. lim g(x)-0. lim f(x)
-
To fill in some of the details in the derivation of the smallest phase increment separating two resolvable FabryPerot fringes, that is, satisfy yourself that Show that Eq. (9.72) can be rewritten as...
-
Brian Rafferty ingested finasteride, a drug prescribed to him to treat an enlarged prostate. Finasteride is a generic version of Proscar, a drug manufactured by Merck. Some time after he started to...
-
Beth R. Jordan lives at 2322 Skyview Road, Mesa, AZ 85201. She is a tax accountant with Mesa Manufacturing Company, 1203 Western Avenue, Mesa, AZ 85201 (employer identification number 11-1111111)....
-
1. [10] Is Grtzsch graph M(C5) Hamiltonian? Is the complement of M(C5) Hamilto- nian? Justify your answer.
-
Establishing rapport is a crucial step at the enquiry and interview stage. In preparing for your interview and meeting this client for the first time, list 10 ways you will aim to both establish...
-
A ramp, AB, of length 8 m and mass 20 kg, rests in equilibrium with the end A on rough horizontal ground. The ramp rests on a smooth solid cylindrical drum which is partly under the ground. The drum...
-
Assume that the present date is June 1 5 , 2 0 2 1 and that you wish to deposit a lump sum today so that you can withdraw $ 1 0 0 , 0 0 0 on June 1 5 , 2 0 2 7 , June 1 5 , 2 0 2 8 , and June 1 5 , 2...
-
For the month of October, the Accounting and IT departments incurred costs of $180,000 and $260,000, respectively. The company uses the step-down method to allocate support costs with the accounting...
-
Within six months, a 35% rise in revenue is part of the aim. Which three important business-related topics should the company plan emphasise?
-
Explain how a subroutine, an interrupt service routine, and an exception handler differ with regard to these aspects. a. Invoking source, (i.e., what "causes" execution) b. Conditions when invoked,...
-
The effective interest rate on bonds payable reflects the effective cost of borrowing at what interest rate?
-
Last week, you received detailed feedback from your instructor on Section 3 of your Go-to-Market Strategy. You will review and revise Section 3 (Product Differentiation and Positioning) of your...
-
Use the graphs of f and g to graph h(x) = (f + g) (x). To print an enlarged copy of the graph, go to MathGraphs.com. 1. 2. y 24 8. 2. -2 -2 4 6
-
Use the method of antithetic variates that was described in Exercise 15. Let g(x) be the function that we tried to integrate in Example 12.4.1. Let f (x) be the function f3 in Example 12.4.1....
-
Suppose that X1, . . . , Xn form a random sample from the exponential distribution with mean . Let Xn be the sample average. Find a variance stabilizing transformation for Xn.
-
Suppose that either of two instruments might be used for making a certain measurement. Instrument 1 yields a measurement whose p.d.f. h1 is Instrument 2 yields a measurement whose p.d.f. h2 is...
-
Which of Yellows statements regarding the factors affecting the selection of a trading strategy is correct? A. Statement 1 B. Statement 2 C. Statement 3 Robert Harding is a portfolio manager at...
-
Given the parameters for the benchmark given by Harding, Yellow should recommend a benchmark that is based on the: A. arrival price. B. time-weighted average price. C. volume-weighted average price....
-
To fill the remaining portion of the ABC order, Yellow is using: A. an arrival price trading strategy. B. a TWAP participation strategy. C. a VWAP participation strategy. Robert Harding is a...
Study smarter with the SolutionInn App