Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help! and please do it in Python! In this short PA, you should write three separate program to print out bars of hash-tags() in
Please help! and please do it in Python!
In this short PA, you should write three separate program to print out bars of hash-tags() in various ways. Completing this PA should give you some confidence/preparation to start working on the regular PA for this week, so work on this first! You should name the programs rab.pyl cab.pyl and lab.py (Acronyms for Right-, Center, and Left-aligned bars). Each of the three program should accept one input value, a string of digit characters, 0-9. The program should not accept any other characters (such as letters, commas, periods, etc) in the input. The behaviour of each of the programs is described below. Left-aligned bars (lab.py) Lab.py Should accept a string of digits as input. The program should Enter bar string: iterate through each of the digits in the string and convert the individual 71727 digits to integers. For each of the numbers, the program should print out the corresponding number of horizontal bars of characters, within a nicely-formatted box. The box should always be 11 characters wide in total, but the height may vary based on the length of the input string. Two example runs of the program are shown on the left Enter bar string: 2378945 INO I NON IMUNDON IMUNOON INONDONI I NON INONNO IMUNOON IN INONDON IND I NONOON Right-aligned bars (rab.py) Enter bar string: 2378945 rab.py should accept the same type of input as Lab.py. It should print out a box with the bars right-aligned, instead of left-aligned. Two example runs of the program are shown on the left. Enter bar string: 71727 MOON 1 1 INDONO I ONDONI INONDONO 1 ANNO 1 DONO NDONO 1 1 MADONNOI Enter bar string: 355399271122 Enter bar string: 13155371 ANNON Center-aligned bars (cab.py) cab.py Should accept a string of digits as input. However, the way that the program uses the numbers should differ slightly from Lab.py and rab.py in cab.py) each pair of numbers is used to produce the output on a given row. the bars should "start" from the center of the 20-character-wide box, and the input string specifies how much they should jut-out to the left and to the right. For instance, look at the first example in the table to the right. In the first row, the bar has three to the left of center, and five characters to the right of center. This is specified by the 35 in the input string. The third and fourth characters, 53, specifies 5 to the left and three to the right. Commenting and Style WONDON DONNON INONDON MONNONDONI MONDONO 1 1 1 1 MONMON You should follow all of the code style and structure rules describes in the style guide, available from the class websiteStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started