Program Python untuk Mencetak Output Tanpa Newline

0
(0)

Menggunakan kata kunci akhir

# print each statement on a new line
print("Python")
print("is easy to learn.")

# new line
print()

# print both the statements on a single line
print("Python", end=" ")
print("is easy to learn.")

Keluaran

Python
is easy to learn.

Python is easy to learn.

Menggunakan end kata kunci, Anda dapat menambahkan string di akhir teks cetak. Dalam contoh di atas, kami telah memberikan spasi dengan end, yang menambahkan spasi di akhir baris dan menggabungkan konten pernyataan cetak berikutnya.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Reply

Your email address will not be published. Required fields are marked *