I wrote my code to this but I just can't figure out what the heck i'm doing wrong to get it to work.. I will attach my code and the problem for python program4_2.py Write a program that displays a table of inches and equivalent lengths in centimeters using f-strings. You can find the conversion factor online if necessary. Store this factor in a properly named constant. Allow the user to specify the range of inches for the table by prompting for the start, stop, and step values for the inches column. Display the inches accurate to one decimal place left-aligned in a column 8 characters wide. The centimeters should display accurate to two decimal places and centered in a column 12 characters wide (see page 75-78). Column headings should be displayed using the same widths alignments. inches=2.54 start=int(input('Enter the start for inches ')) stop=int(input('Enter the stop for inches ')) step=int(input('Enter the step for inches ')) for inches in range (start, step + 1): centimeters = start * inches print () print('inches\tcentimeters') print(f'{inches:<8.1f}\t{centimeters:^12.2f}')
I wrote my code to this but I just can't figure out what the heck i'm doing wrong to get it to work.. I will attach my code and the problem for python program4_2.py
Write a program that displays a table of inches and equivalent lengths in centimeters using f-strings. You can find the conversion factor online if necessary. Store this factor in a properly named constant. Allow the user to specify the range of inches for the table by prompting for the start, stop, and step values for the inches column. Display the inches accurate to one decimal place left-aligned in a column 8 characters wide. The centimeters should display accurate to two decimal places and centered in a column 12 characters wide (see page 75-78). Column headings should be displayed using the same widths alignments.
inches=2.54
start=int(input('Enter the start for inches '))
stop=int(input('Enter the stop for inches '))
step=int(input('Enter the step for inches '))
for inches in range (start, step + 1):
centimeters = start * inches
print ()
print('inches\tcentimeters')
print(f'{inches:<8.1f}\t{centimeters:^12.2f}')
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images