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...
-
Seaside Water Company reported the following items on its statement of shareholders' equity for the year ended December 31, 2016 (amounts in thousands of dollars): Requirements 1. Determine the...
-
From the data in Table 12.3, compute the theoretical density of CaF2, which has the fluoritestructure. Ionic Radius Ionic Radius Cation (nm) Anion (nm) Al+ Ba2+ Ca2+ Cs* Fe+ Fe+ K+ Mg+ Mn2+ 0.053 Br...
-
Was the decision by Ikea to recall and stop production of the Sladda appropriate? Explain both why and why not.
-
This problem continues the accounting process for Fitness Equipment Doctor, Inc., from the Continuing Problem in Chapter 2. The trial balance for Fitness Equipment Doctor, Inc., at April 30, 2018,...
-
For the function f(x) = 2 x in the range 0 x <1 find (a) the Fourier sine series and (b) the Fourier cosine series. Which would be better for numerical evaluation? [Hint: extend the definition of the...
-
Do high school programs that emphasize science, technology, engineering and mathematics (STEM) lead to jobs? This was a question of interest in the second Longitudinal Study of Young People in...
-
On August 1, 2020, Halifax Corporation purchased a truck with a cost of $57,000 and paid an additional $2,800 in freight to ship the truck to Halifax Corporation's warehouse. The truck has an...
-
23. Solve the recurrence relation using substitution method and verify using Master's method T(n) = 4T(n/2) + n, n >1 and T(n) =1, n=1
-
To what component we define attributes? Explain
-
If you were to open a small business with the knowledge and skills you have acquired to this point, would you prefer to keep your accounting records on the cash basis or the accrual basis? Reflect on...
-
The following transactions were completed by the company: a. The owner invested $18,400 cash in the company. b. The company purchased supplies for $1,350 cash. c. The owner invested $11,700 of...
-
Apple and Banana incorporated Fruit Corp. in 2023. As part of a prearranged transaction, Apple transferred equipment worth $89,348 (basis of $19,087) to Fruit Corp. in exchange for 50% of Fruit...
-
Write a program to find the largest hexadecimal number from the data stored at a memory location. The numbers are: 69,87,96,45, and 75. Attache the code and the result screen from the DOSBOX.
-
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...
-
What is the burden of proof in a criminal trial? How does it compare to the burden of proof in a civil trial?
-
What are presumptions, and why are they important?
-
Distinguish between adversarial and inquisitorial justice.
Study smarter with the SolutionInn App