-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
  • 107,083
  • 22
  • 201
  • 376

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
  • 1,774
  • 1
  • 3
  • 21
-1

I recommend you use:

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