L
L
Lis42018-09-27 14:07:39
Python
Lis4, 2018-09-27 14:07:39

What will be corrected in the code so that the answer contains not only a number, but also a text?

Please help me find the error.
Started learning Python, learned only variables and the second syntax lesson.
Given the task to write a code to calculate the ideal weight.
My weight comes out right, but the tex does not come out, I can’t understand where the error is.

v=int(input('Ваш идеальный вес по формуле Брока. Какого вы роста в сантиметрах ?'))
if(v <= 165 ):
    x=int(input(v - 100))
    print('Ваш идеальный вес','x')
elif(v<= 175):
    x='Ваш'+ int(input(v - 105))
    print('Ваш идеальный вес') + 'x'
elif(v>= 176):
    x=int(input(v - 110))
    print('Ваш вес должен составлять') + x

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Statkevich, 2018-09-27
@Lis4

It is better to use this method
print('Your weight should be {} kg'.format(x))
in place of {} will
be your X, maybe a few, you will come to this a little later...

name = 'Игорь'
weight = 90
print('Ваш вес {} должен составлять {} кг'.format(name, weight))

At the output we get "Your weight Igor is 90 kg"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question