Write the code for function diamond in the file exercise1.py. The function diamond: takes one...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write the code for function diamond in the file exercise1.py. The function diamond: • takes one parameter N (type int), its value must be odd and in the range [3,99] • it draws a square shape made of integer values and spaces: integer values are always printed with 2 digits (for example, value 7 is printed 07 every line consists of integer values from 1 up to N, where some values have to be replaced by spaces instead the first and last row are full (no space) the middle row is empty except for values 1 and N each row from the first one to the middle one is increasingly empty from its center each row from the middle one to the last one is increasingly full to its center Below are a couple of example outputs when using the diamond function from the shell: >>> diamond (5) 0102030405 0102 0405 01 05 0102 0405 0102030405 Write the code for function diamond in the file exercise1.py. The function diamond: • takes one parameter N (type int), its value must be odd and in the range [3,99] • it draws a square shape made of integer values and spaces: integer values are always printed with 2 digits (for example, value 7 is printed 07 every line consists of integer values from 1 up to N, where some values have to be replaced by spaces instead the first and last row are full (no space) the middle row is empty except for values 1 and N each row from the first one to the middle one is increasingly empty from its center each row from the middle one to the last one is increasingly full to its center Below are a couple of example outputs when using the diamond function from the shell: >>> diamond (5) 0102030405 0102 0405 01 05 0102 0405 0102030405
Expert Answer:
Answer rating: 100% (QA)
from os import sys def diamondn rintn12 for i in ranger for j in rangen if j1 ... View the full answer
Related Book For
Concepts of Database Management
ISBN: 978-111182591
7th edition
Authors: Philip J. Pratt, Joseph J. Adamski
Posted Date:
Students also viewed these programming questions
-
Write the code for the following triggers following the style shown in the text. a. When adding a customer, add the customers balance times the sales reps commission rate to the commission for the...
-
You are to write the code for a convergence module that can deal with one to three tear stream variables using theWegstein algorithm, as outlined in Appendix A.2. The object is to determine the...
-
Write the code for a function named GetState. The function should prompt the user to enter the name of a U.S. state and then return the users response. Then write a statement to invoke the GetState...
-
What is the coefficient of sliding friction and what is a representative value for this coefficient for the brittle crust?
-
Access "ww.ecomerce-guide.com" Find the product review area. Read review of three software payment solutions. Assess the payment solutions as possible components?
-
Future-prospective The marketing information system is future-oriented since it gives required information for resolving future concerns. It does not incorporate any remedial steps for previous...
-
Watch Bettina Warburg's TED Talk titled "How the Blockchain Will Radically Transform the Economy," dated June 2016 at https://www.ted.com/talks/bettina_warburg_...
-
1. Which approaches to employee development are mentioned in this case for Zappos? Which are mentioned for General Electric? 2. These two companies are both well respected and successful but have...
-
Deductibles, copayments, and noncovered charges are considered 19. Deductibles, copayments, and noncovered charges are considered a. amounts that a provider must waive. b. disbursements from...
-
1. Why do you think the regions are not responding to Wilkess initiative for change? What did Wilkes do wrong with respect to implementing the change? 2. Should Wilkes solicit more active support...
-
1\2 X y N a 1,2 2,2 5,1 b 4,1 3,5 3,3 C 5,2 4,4 7,0 d 2,3 0,4 3,0 Find all strategy profiles that form pure strategy Nash equilibria (there may be more than one, or none):
-
Answer ALL questions in this section. 1. Identify and briefly explain any four ways in which Corporations differ from Sole proprietors and Partnerships (8 marks) 2. Outline any four roles of...
-
The CVP income statements shown below are available for AX Company and ZY Company at the beginning of 2020. AX Company ZY Company Sales $500,000 $500,000 Variable Costs $110,000 $10,000 Contribution...
-
What leadership practices best facilitate the integration of sustainability and corporate social responsibility into core business operations ?
-
Julie spends $X on a new altcoin (Huskoin), keeps it for 7 months and sells it for $10,000. The monthly growth rate for the first 4 months was 4% per month and 6% per month for the last three months....
-
A driver accelerates a 240 kg snowmobile from 6 m/sec to 28 m/sec over a time of 60 sec. a. What is the change in momentum of the snowmobile? (5280 kg m/sec) b. What is the impulse acting on the...
-
1.Consider two hypothetical companies, A and B. Company A is a top-rated AAA company, whereas company B is a lower-rated BBB company. Assume that company A wants to raise debt and pays a floating...
-
$10,000 was borrowed at 3.5% on July 17. The borrower repaid $5000 on August 12, and $2000 on September 18. What final payment is required on November 12 to fully repay the loan?
-
Describe the process of creating a table in SQL and the different data types you can use for fields.
-
Consider a Student table containing StudentNum, StudentName, students StudentMajor, students AdvisorNum, students AdvisorName, students AdvisorOfficeNum, students AdvisorPhone, students NumCredits,...
-
How can the complexity of a DBMS be a disadvantage?
-
Which of the following items would be most useful in analyzing the separation of duties and functions in an application system? (a) document flowchart (b) program flowchart (c) HIPO chart (d) source...
-
An important omission from flowcharts and matrix techniques is ( ___________________ ). (a) the ability to represent decisions (b) the ability to include internal control considerations (c) the...
-
In the preparation of a logical data flow diagram for a payroll processing application, which of the following symbols should be used to indicate the payroll data? (a) terminator symbol (b) data...
Study smarter with the SolutionInn App