Помогите пожалуйста! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Помогите пожалуйста!

У меня не работает код в чем проблема? https://code.sololearn.com/cUK2OeL079b4/?ref=app

28th Mar 2022, 3:26 AM
MrX
MrX - avatar
2 Answers
+ 4
Hi YarikRo! The reason it doesn't work is because you can't directly add an integer with a string. You have to try one of the ways that I mentioned below to combine a string with an integer. 1. Using normal addition or String concatenation print (str(x)+ " - четное число.") 2. Using comma as separator print (x ,"- четное число.") 3. Using f-string print (f"{x} - четное число.") 4. Using .format() print ("{ } - четное число.".format(x)) 5. Using the % operator print ("%d - четное число."%(x))
28th Mar 2022, 3:41 AM
Python Learner
Python Learner - avatar
+ 1
Thanks
28th Mar 2022, 3:42 AM
MrX
MrX - avatar