Question 11 (20 points) Write a program that reads a positive integer, , and prints a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 11 (20 points) Write a program that reads a positive integer, , and prints a nxn square chess board shape. That is a nxn square with an alternating pattern of squares in two colors. In this question, instead of two colors, we will use two symbols 'X' and 'O'. Your program should interact with the user exactly as demonstrated in the following two executions: Execution example 1: Please enter a positive integer: 3 XOX OXO XOX Execution example 2: Please enter a positive integer: 8 XOXOXOXO OXOXOXOX XOXOXOXO OXOXOXOX XOXOXOXO OXOXOXOX XOXOXOXO oxoxoxox Question 11 (20 points) Write a program that reads a positive integer, , and prints a nxn square chess board shape. That is a nxn square with an alternating pattern of squares in two colors. In this question, instead of two colors, we will use two symbols 'X' and 'O'. Your program should interact with the user exactly as demonstrated in the following two executions: Execution example 1: Please enter a positive integer: 3 XOX OXO XOX Execution example 2: Please enter a positive integer: 8 XOXOXOXO OXOXOXOX XOXOXOXO OXOXOXOX XOXOXOXO OXOXOXOX XOXOXOXO oxoxoxox
Expert Answer:
Answer rating: 100% (QA)
Here is a solution in Python def printchessboardn for i in r... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
Write a program that reads in an investment amount, the annual interest rate, and the number of years, and displays the future investment value using the following formula: futureInvestmentValue =...
-
Write a program that reads a file containing text. Read each line and send it to the output file, preceded by line numbers. If the input file is Mary had a little lamb Whose fleece was white as snow....
-
Write a program that reads from a text file "students.txt" student information of a given class and stores them into a list of dictionaries. Each line of the file contains a student id (integer), a...
-
Addison, Inc. makes a single product, an indoor fireplace. Data for last year is as follows: Selling price per fireplace Manufacturing costs: Variable per unit produced: Direct materials Direct labor...
-
Where are investments in bonds that are classified as held-to-maturity securities reported on the balance sheet?
-
The average demand is equal to 10 units per day, the order lead time is 7 days, and the standard deviation of the lead time demand is 4 units. If a 95 percent service level is desired, what is the...
-
Claims against governmental bodies generally cannot be brought into court unless administrative procedures are followed first. Often, a notice of claim must be filed first. Assume someone is injured...
-
Suppose you are a supervisor. What errors might you make when preparing the performance appraisal on a clerical employee? How might you avoid those errors?
-
You are engaged in a large project that requires complex coordination between many departments in your organisation. You have almost completed the planning phase and are looking for sign-off of the...
-
Buckeye Manufacturing produces heads for engines used in the manufacture of trucks. The production line is highly complex, and it measures 900 feet in length. Two types of engine heads are produced...
-
My initial recommendation for this company would've been to use SHOP and find a healthcare plan that fit the employees' needs while also being affordable. Unfortunately, SHOP is not currently...
-
A fitness center is interested in the mean amount of time a client exercises in the center each week. identify: a. the population, b. the sample, c. the parameter, d. the statistic, e. the variable,...
-
A well-designed management information system using EDP equipment will include methods of assuring that the data are appropriate to the situation and are accurate. Required: a. Describe procedures...
-
The following control procedures over sales transactions are prescribed by the Harlan Company: 1. Credit department approval of credit sales. 2. Sales invoice for each shipping document. 3. Internal...
-
The customer billing function of the Robinson Company, a small paint manufacturer, is attended to by a receptionist, an accounts receivable clerk and a cashier who also serves as a secretary. The...
-
The Joppa Corporation's sales department receives all sales order (mail or phone), prepares the sales order form, and forwards a copy to the credit manager for credit approval. On indicating...
-
a brief explanation of how this code works you can just explain the main part thank you (I have attached the code screenshot and the code output below) 40 import javafx.application. Application; 12...
-
In Exercises delete part of the domain so that the function that remains is one-to-one. Find the inverse function of the remaining function and give the domain of the inverse function. f(x) = 16x4 -3...
-
Assume that a singly linked list is implemented with a header node, but no tail node, and that it maintains only a reference to the header node. Write a class that includes methods to a. Return the...
-
Show that if all of the unions precede the finds, then the disjoint set algorithm with path compression requires linear time, even if the unions are done arbitrarily.
-
Show that the expected depth of the kth smallest element in a large complete heap (you may assume N = 2k 1) is bounded by log k.
-
For the Scotch yoke mechanism shown in Fig.3.27, find the velocity and acceleration of point \(B\). \(\omega_{2}=5 \mathrm{rad} / \mathrm{s}\), and \(O_{2} A=100 \mathrm{~mm}\). 2 45 3 .B. Scale: 1...
-
In Example 3.14 , calculate analytically, the acceleration of the piston and angular acceleration of the rod.
-
The crank of an engine \(300 \mathrm{~mm}\) long rotates at a uniform speed of \(300 \mathrm{rpm}\). The ratio of connecting rod length to crank radius is 4 . Determine (a) acceleration of the...
Study smarter with the SolutionInn App