1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Cloud [144]
3 years ago
10

Write a program to display the following diamond-shape like pattern based on the height given by the user. Assume that the user

will always enter a positive odd number.
Computers and Technology
1 answer:
kumpel [21]3 years ago
5 0

Answer:

try:

   size = int(input("Enter a number: "))

except ValueError:

   print("must be a number")

if size==0:

   print("number must be greater than zero.")

elif size%2==0:

   print("number must be odd.")

   

else:

   obj = '#'

   mid_size = round(size/2)

   s = size - mid_size

   count = 2

   counts = 1

   for i in range(size+1):

       if i<=mid_size:

           print(" " *(size - i) + (obj+" ") * i)

       elif i>mid_size:

           print(" " * (s + counts) + (obj + " ") * (i - count))

           count += 2

           counts += 1

Explanation:

The python source code uses a try and except statement to check for value error and print a diamond shape of the object "#" determined by the input number.

You might be interested in
Are all the computer users known as programmer ​
Evgesh-ka [11]

Answer:

Nope

Explanation:

programmers are diff

6 0
3 years ago
What are the data types in access​
Julli [10]

Answer:

Data type in Microsoft Access Database

Text  

Memo  

Byte  

Integer

Long  

Single  

Double  

Currency  

AutoNumber  

Date/Time  

Yes/No  

Ole Object  

Hyperlink  

Lookup Wizard

Explanation:

4 0
4 years ago
Oliva was a sophomore thriving in college when her father was laid off from his job. Even with financial aid, the family could n
Zielflug [23.3K]

Answer:

Linked Lives

Explanation:

Linked-lives is a popular preposition, the idea is that people who are related to each like father-child or mother-child relationship have similar influencing trajetories of development that cuts across their lives.

6 0
4 years ago
A programmer writes a for statement to count from 1 to 10 and explicitly mentions the 1 and the 10 in the for “header.” which re
o-na [289]
The relational operator used would probably be <=
6 0
3 years ago
Displays information a bout drivers, network connections, and other program-related details.
slava [35]

Answer:

library

Explanation:

hope you like it

6 0
3 years ago
Other questions:
  • ORANGE COLORED SIGNS AND FLAGS MEAN THAT YOU MUST BE ALERT FOR:
    8·2 answers
  • An element in a web page that connects to a different location in the same page or a different page is a _____.
    8·1 answer
  • You are reviewing the style sheet code written by a colleague and notice several rules that are enclosed between the /* and */ c
    12·1 answer
  • ERP implementation probably will not require:
    8·2 answers
  • Simplify the expresion<br>12. 12g + 9g​
    13·1 answer
  • Describe how communication strengthens relationship at work and, as a result, increases your productivity
    9·1 answer
  • A new drug to combat acne has been developed from a compound that is found in a melon. Which scientists would contribute to the
    15·2 answers
  • True or false? The following deterministic finite-state automaton recognizes the set of all bit strings such that the first bit
    7·1 answer
  • HELP PLZZZZZZ
    10·1 answer
  • WHO WANT P O I N T S.................................................
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!