'''
(a) Ask the user to enter 5 integer values between 1 and 50. Create a simple bar graph using the character of your choice.
Hint: You may want to try to use a loop within a loop (a nested loop). Don't forget to indent properly! (2A)
For example: If the user were to enter 3, 1, 6, 2, 5, the output might look like:
###
#
######
##
#####
Extension:
(d) [challenge] Make the bar graph horizontal (2T)
nums = []
for i in range(5):
# User input
num = int(input("Enter integer (1-50): "))
nums.append(num)
print()
# Display bar graph
print("Bar Graph")
for num in nums:
for j in range(num):
print("#", end="")
print()
Comments
Leave a comment