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
Karo-lina-s [1.5K]
3 years ago
6

(1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle t

hat instead uses the user-specified triangle_char character. (1 pt) (2) Modify the program to use a loop to output a right triangle of height triangle_height. The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches triangle_height. Output a space after each user-specified character, including a line's last user-specified character. (2 pts) Example output for triangle_char = % and triangle_height = 5:

Computers and Technology
1 answer:
zloy xaker [14]3 years ago
6 0

Answer:

Following are the code to this question can be described as follows:

c= input('Input triangle_char: ') #defining variable c that input character value  

length = int(input('Enter triangle_height: ')) # Enter total height of triangle

for i in range(length): # loop for column values

   for j in range(i+1): #loop to print row values

       print(c,end=' ') #print value  

   print()# for new line

Output:

please find the attachment.

Explanation:

In the above python code, two variable "c and length" variables are declared, in variable c is used to input char variable value, in the next line, length variable is defined, that accepts total height from the user.

  • In the next line, two for loop is declared, it uses as nested looping, in which the outer loop prints column values and inner the loop is used to prints rows.
  • To prints all the value the print method is used, which prints the user input character triangle.

You might be interested in
Trudy is preparing a reply to an email message. Before she could send out the message, she is called for a meeting. If Trudy has
Ronch [10]
Her Drafts folder. Hope this helped!
3 0
3 years ago
Read 2 more answers
What is the output of this program?
Leto [7]

Answer:

70 is the answer negative one begins from 83 and count down to 89, Therefore, 70 is is -4 and is chosen as the best answer

7 0
3 years ago
You will need to complete the functions these functions: a. get_total This function takes in pennies, nickels, dimes, and quarte
tankabanditka [31]

Answer:

penny = int(input("Enter number of pennies: "))

nickel = int(input("Enter number of nickel: "))

dime = int(input("Enter number of dime: "))

quarter = int(input("Enter number of quarter: "))

def get_total(penny, nickel, dime, quarter):

   total = ((1 * penny) + (5 * nickel) + (10 * dime) + (25 * quarter))/ 100

   print (f"The total amount is {total}")

   

def get_dollars(penny, nickel, dime, quarter):

   dollar = ((1 * penny) + (5 * nickel) + (10 * dime) + (25 * quarter))// 100

   print (f"The dollar part is ${dollar}")

   

def get_left_over_cent(penny, nickel, dime, quarter):

   cent = ((1 * penny) + (5 * nickel) + (10 * dime) + (25 * quarter)) % 100

   print (f"The left over cent is {cent} cents")

 

   

get_total(penny, nickel, dime, quarter)

get_dollars(penny, nickel, dime, quarter)

get_left_over_cent(penny, nickel, dime, quarter)

Explanation:

In the United States, these coins have following values:

Quarter= 25 cents

Dime= 10 cents

Nickel= 5 cents

Penny= 1 cent

The first line collect an input from the user, convert to integer and assign to penny.

The second line collect an input from the user, convert to integer and assign to nickel.

The third line collect an input from the user, convert to integer and assign to dime.

The fourth line collect an input from the user, convert to integer and assign to quarter.

Based on the above definition of penny, nickel, dime and quarter; we defined the various function.

First the get_total function was defined and the total amount was calculated and assigned to total, then the total was output to the user.

Then, the get_dollars function was defined and the dollar part was calculated through dividing the total by 100. (100 cents = $1). The dollar was also output to the user.

Then, the get_left_over_cents function was defined and the cent was calculated by finding the remainder when the total is divided by 100 (cent = total % 100). The symbol "%" represent modulo and is used to find remainder of a division operation.

6 0
3 years ago
Ill mark you the brainleist and give you 50 points if you wanna chat
tekilochka [14]

sure! what do you wanna chat about?

6 0
3 years ago
Who want to play quzzies the code is 124 3142
konstantin123 [22]

Answer:

22

Explanation:

11+11=22

7 0
3 years ago
Other questions:
  • Which statement about word processing software is true? A)You can use it to perform mathematical calculations.B) You can use it
    6·2 answers
  • Write a program to read as many test scores as the user wants from the keyboard (assuming at most 50 scores). Print the scores i
    13·1 answer
  • The equation y=2x+1 represents a function true or false
    11·1 answer
  • Given the following code fragment, how many times does the loop body execute? int laps = 50; int myNum = 1; do { myNum = myNum +
    9·1 answer
  • Your co-worker is at a conference in another state. She requests that you
    9·1 answer
  • Which statement best describes a transition in PowerPoint?
    12·1 answer
  • Natalie is a secretary and must complete a large amount of filing this afternoon. At 1:00 PM, the office receptionist gets sick
    10·1 answer
  • Please help ASAP, will mark brainliest!
    7·1 answer
  • Electrical data suitable for transmission is called a(n)
    5·1 answer
  • Explain the correct ways of using keyboard. .​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!