-2

I need help with creating a table. The question is asking me to write a function that outputs a two column table of kilogram weights and their pound equivalents for kilogram values 0, 10, 20 ..., 100.

So far I have:

kilos = eval(input("Enter a weight in kilograms: ")) 
pounds = 2.2 * kilos 
print("The weight in pounds is", pounds)

but I have no idea how to construct this as a table.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Walid Yusof
  • 21
  • 1
  • 3
  • 2
    What have you tried so far? StackOverflow isn't here to do your work for you. We're here to help you with problems you've encountered! – Blckknght Oct 04 '14 at 12:00
  • What did you try? You probably want to loop over every row, while displaying the 2 elements. – user189 Oct 04 '14 at 12:00
  • sorry ive got something like 'kilos = eval(input("Enter a weight in kilograms: "))' 'pounds = 2.2 * kilos' 'print("The weight in pounds is", pounds)' but I have no idea how to construct this as a table. As i said, any help is appreciated. @Blckknght – Walid Yusof Oct 04 '14 at 12:06
  • Ulgh - please see http://stackoverflow.com/q/1832940/3001761. What do you mean *"construct this as a table"*? On a web page, like [this](http://stackoverflow.com/q/12453799/3001761)? In a database? In the interpreter? – jonrsharpe Oct 04 '14 at 12:11
  • Yes, similar to that table. I just need to show it in an IDE @jonrsharpe, but thank you anyways. Someone gave me a pretty useful answer. – Walid Yusof Oct 04 '14 at 12:18

1 Answers1

0

By table I assume that you are trying to print the output on console.

mult_factor = 2.20462 
print ('Kilogram', 'Pound')
for i in range (0, 100, 10):
    print (i , i * mult_factor)
bhavesh
  • 1,343
  • 2
  • 14
  • 23