Can somebody help me? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Can somebody help me?

I don't know why the input "Enter number" and the result are displayed on the same line Here is the code: x = int(input("Enter number:")) if x == 7: print('Correct!') else: if x < 7: print('Less then 7!') if x > 7: print('Greater then 7!')

7th Dec 2017, 4:53 PM
Andreiski
Andreiski - avatar
1 ответ
+ 7
x = int(input("Enter number: ")) print (x, end="") if x == 7: print("\nCorrect!") else: if x < 7: print("\nLess then 7!") if x > 7: print("\nGreater then 7!") The \n inserts a line break character into a string, @Mind To Machine was right..
7th Dec 2017, 5:09 PM
Ipang