L
L
lazyvasya2282020-07-15 10:36:31
Python
lazyvasya228, 2020-07-15 10:36:31

How to output multiple variable values ​​from a new line?

model = 1
color = "black"
year = 2010
number_of_doors = 6

print(model, \n color, \n year, \n number_of_doors)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bbkmzzzz, 2020-07-15
@bbkmzzzz

Strings

model = 1
color = "black"
year = 2010
number_of_doors = 6

print(str(model) + "\n" + color + "\n" + str(year) + "\n" + str(number_of_doors))
print('####')

print("%d\n%s\n%d\n%d" % (model, color, year, number_of_doors))
print('####')

print(f"{model}\n" \
        f"{color}\n" \
        f"{year}\n" \
        f"{number_of_doors}")
print("####")

print(f"{model}\n{color}\n{year}\n{number_of_doors}")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question