Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is my code and it is in PYTHON also please use while loop IN ZY BOOKS I have to make a right hollow triangle

Below is my code and it is in PYTHON

also please use while loop

IN ZY BOOKS I have to make a right hollow triangle based on input when I run this code the triangle does print out but there are some errors I need help with

the computer is reading some white space and it's telling me to print a new line I've tried using print(' ', end = '' ) please help I will rate positively # Suggested steps are:

# 1. Display the prompt # 2. Read in the triangle size into a variable # 3. Print the triangle # This step should be further broken down! # 4. Add the code to check the user input, in case it is negative.

__________________________________________

trianglesize = int(input("Enter triangle size: ") ) if trianglesize 0. Exiting..." ) print() a=1 for row in range(1,trianglesize+1): if (row==1 or row==trianglesize or row==2): #print('* ', end = '') print("* "*row) else: b=2*a print("* " + (" ")*b + "*") a=a+1 print('', end = '' )

_______________________________________________

above code does print out perfect triangle

I JUST NEED HELP SOLVING ERROR AND SATISFYING ZYBOOKS

(CHECK POINTED ARROWS IN THE PIC)

image text in transcribed

Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input 1 Your output Enter triangle size: / Enter triangle size: Expected output Small even number Small odd number Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input 7 Enter triangle size: Your output Enter triangle size: Expected output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

var(aX+bY)= A. a2x2++b2y2 B. XY++XY C. aX2+bY2. D. a2X2+2abXY+b2Y2

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago