Diamond functions-python

Assignment Help Basic Computer Science
Reference no: EM131994315

If you could edit the following code to help it do the following "printDiamond" function; it only composes half of it currently, using python 3

printDiamond

For these "diamond" functions, you may use string multiplication, but only for strings of blank spaces, such as ' '*n or the like. Each visible character should be printed separately, just as in the functions earlier in this problem. Also, you don't have to use the string *operator for strings of spaces, either.

Compose a function called printDiamond( width, symbol ) that prints a diamond of symbol whose maximum width is determined by width.

printDiamond( 3, '&' )

   &

  & &

 & & &

  & &

   &

My code:

def printDiamond(width,symbol):

  for i in range(width):

    spaces = ""

    redundancy = symbol+""

    print(spaces*(width-i)+redundancy*i)

  for i in range(width):

    spaces = ""

    redundancy = symbol + ""

    print(spaces*i+redundancy*(width-i))

Reference no: EM131994315

Questions Cloud

Discuss systems theories and major models of family : In addition, describe a systems perspective that provides an understanding of family and other systems theories and major models of family.
Briefly describe the ethical dilemma or issue : Briefly describe the ethical dilemma or issue. Explain why you think this is particularly critical and poses a danger to Uber's sustainability.
Multiple of ebitda and multiple of refining capacity : A common way to value midstream and downstream energy assets is by using a multiple of EBITDA and a multiple of refining capacity.
Distributed applications and cloud computing : Distributed applications and cloud computing have become a viable option within the LAN-to-WAN Domain.
Diamond functions-python : If you could edit the following code to help it do the following "printDiamond" function; it only composes half of it currently, using python 3
Considering two mutually exclusive expansion plans : A company is considering two mutually exclusive expansion plans. Calculate the crossover rate where the two projects' NPVs are equal.
Should employers be allowed to read employee e-mail : Should employers be allowed to read employee e-mail, inspect their Facebook pages or blogs, or access files located on a personal computer at work?
What is firmware : What is firmware? How is it similar to software and hardware? How is it different?
Create healthier and better society in the near future : Do you think more technologies will create healthier and better society in the near future?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd