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
Vedmedyk [2.9K]
3 years ago
10

3.17 (LAB) Ch 5 Warm up: Drawing a right triangle (Python 3) This program will output a right triangle based on user specified h

eight triangle_height and symbol triangle_char. (1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that 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: Enter a character: % Enter triangle height: 5 % % % % % % % % % % % % % % %
Computers and Technology
1 answer:
andre [41]3 years ago
3 0

Answer:

Find answers below

Explanation:

triangle_char = input('Enter a character: ')

triangle_height = int(input('Enter triangle height: '))

print('')

for j in range (triangle_height):

   print((triangle_char) * (j + 1))

#below are sample output that can be gotten with predefined values

$ ./triangles.py  

Enter characters: jk

Enter height: 8

j

jj

jjj

jjjj

jjjjj

jjjjjj

jjjjjjj

jjjjjjjj

k

kk

kkk

kkkk

kkkkk

kkkkkk

kkkkkkk

kkkkkkkk

You might be interested in
Read the following scenario what type of business letter do you think is required in this situation?
grandymaker [24]

Answer:

Cover letter

Explanation:

The type of business letter Melissa and Melrose would need to write is a Cover letter.

The Cover Letter is usually not more than a page document which gives a kind of summary or hint about who individual is and the quality of the individual, while highlighting why an individual is the best fit for the role they are seeking for.

Most recruiters usually make use of the cover letter, as a first hurdle, to screen out applicants especially when applications are much.

Melissa and Melrose, in addition to the resume they would submit for the volunteering job, would need a cover letter.

8 0
3 years ago
Read 2 more answers
in python i wrote a function where if the user inputs a certain word the function repeats over again, since the function aaks fo
Colt1911 [192]
Check out the counter set
4 0
2 years ago
Write a Python 3 program to read from a .csv file containing rates from power companies. Your program should determine the avera
aliya0001 [1]

Answer:

In python:

file = open("rates.csv", "r")

ratecount = 0

ratesum = 0

mylist = []

rates = file.readlines()

for nums in rates:

     num = nums.rstrip('\n')

     mylist.append(int(num))

     for i in num:

           ratesum= ratesum + int(i)

           ratecount = ratecount + 1

print("Maximum Rate: "+str(max(mylist)))

print("Minimum Rate: "+str(min(mylist)))

print("Average Rate: "+str(ratesum/ratecount))

Explanation:

This opens the csv file

file = open("rates.csv", "r")

This initializes the number of rates in the file

ratecount = 0

This initializes the sum of the rates

ratesum = 0

This initializes an empty list

mylist = []

This reads the rates into lines

rates = file.readlines()

This iterates through the rates (as a string)

for nums in rates:

This removes the newline character \n in the rates

     num = nums.rstrip('\n')

This appends the rates (as an integer) to the empty list

     mylist.append(int(num))

The following counts the rates in the file and also sum them up

<em>      for i in num: </em>

<em>            ratesum= ratesum + int(i) </em>

<em>            ratecount = ratecount + 1 </em>

This prints the maximum of the rates

print("Maximum Rate: "+str(max(mylist)))

This prints the minimum of the rates

print("Minimum Rate: "+str(min(mylist)))

This calculates and prints the average rate

print("Average Rate: "+str(ratesum/ratecount))

6 0
3 years ago
How/when should you use student loans?
mote1985 [20]

Answer:

Things you should use your student loan to pay for: Books and supplies; Room and board (meal plans) Off-campus housing; Transportation (gas, bus pass, etc.) Computers; Any equipment you need for classes; Sheets and towels and Things you should not use your student loan to pay for: Pizza and beer for your roomies; Spring break travel; Taking your family out to dinner; Buying a new Mercedes; An outfit for a friend’s wedding; Cleaning services; Entertainment

Explanation:

3 0
2 years ago
What type of system converts between plaintext and ciphertext?
IRISSAK [1]
Cryptographic system converts between plaintext and ciphertext. Cryptography is t<span>he process of making and using codes to secure transmission of information.
The c</span>ryptographic system involves encryption (the process of converting original message into a form unreadable by unauthorized individuals) and decryption (t<span>he process of converting the cipher text message back into plaintext so that it can be readily understood.)</span>
7 0
3 years ago
Other questions:
  • This is an electronic method used to send and receive data–voice, text, images, and video.
    13·2 answers
  • Explain how to identify a starting position on a line.
    15·2 answers
  • What was one complication caused by the tsunami that struck japan in 2011?
    15·1 answer
  • Imagine you are building an ATM system; list at least 6 application domains for the system. That is, in which context is the sys
    13·1 answer
  • Which of the following is a change that will not affect the pressure in a container?
    9·2 answers
  • Produce definition in computer
    9·2 answers
  • Before posting a picture online, make sure to
    7·1 answer
  • Exercise#3: Write a ch program that performs the following: Declare a two arrays called arrayA and arrayB that holds integer and
    6·1 answer
  • How to give a file name as an argument in function in python.
    11·1 answer
  • I need help now with YT
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!