-1

I want this same print statement to give me these variables in separate statements:

x = 22.4
y = 23.4

print(y,\n x)

but Python doesn't seem to think it's obvious.

I have tried the r/n and I have also tried printing out my variables with separate print statements, but that is not what I want.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

2 Answers2

-1
print(f'{y} \n{x}')

This will go good

https://www.geeksforgeeks.org/formatted-string-literals-f-strings-python/

This link will explain how we use f- strings

Divyessh
  • 2,540
  • 1
  • 7
  • 24
-1

I recommend you use:

print("{}\n{}".format(x,y))
theLudo
  • 127
  • 4