My code is giving incorrect output while everything seems to be alright.
The purpose of the code is to translate inches into centimetres and vice versa.
For example, with inpput cm
then 6
, the output is:
inch: 6, centimeter: 15.24
But it should be:
inch: 2.362, centimeter: 6
Code:
```py
def intocm():
ms = input('What is it? (inch-in or centimeter-cm): ')
am = int(input('How many of it: '))
intocm = 2.54
global inch
global cm
if ms == 'inch' or 'in':
cm = am * intocm
inch = am
elif ms == 'centimeter' or ms == 'cm':
cm = am
inch = cm / intocm
print(f'inch: {inch}, centimeter: {cm}')
intocm()