Your first program · Program pertamamu
Welcome
- Python follows your instructions, one line at a time.
- You write code here and run it — nothing to install.
- Read each step, then press Continue.
Selamat datang
- Python mengikuti instruksi Anda, satu baris demi satu baris.
- Anda menulis kode di sini dan menjalankannya — tidak perlu instalasi apa pun.
- Bacalah setiap langkah, lalu tekan Lanjutkan.
Show text with print
print(...)shows text on the screen.- Put the text in quotes:
"...". - Each
printstarts a new line.
Menampilkan teks dengan print
print(...)menampilkan teks di layar.- Letakkan teks dalam tanda kutip:
"...". - Setiap
printmemulai baris baru.
print("Welcome to Python!")
print("This line runs next.")
Strings
- Text in quotes is called a string.
- You can use double quotes
"..."or single quotes'...'. - You can also print a number with no quotes, like
print(42).
String
- Teks dalam tanda kutip disebut string.
- Anda dapat menggunakan tanda kutip ganda
"..."atau tanda kutip tunggal'...'. - Anda juga dapat mencetak angka tanpa tanda kutip, seperti
print(42).
Comments
- A line that starts with
#is a comment. - Python ignores comments — they do not run.
- Use them to leave notes for people who read your code.
Komentar
- Baris yang dimulai dengan
#adalah komentar. - Python mengabaikan komentar — mereka tidak dijalankan.
- Gunakanlah untuk meninggalkan catatan bagi orang yang membaca kode Anda.
# This line is a note for people. Python skips it.
print("Comments do not show.")
Common mistakes
printneeds quotes around text:print("Hi"), notprint(Hi).- Python is case-sensitive:
Printis not the same asprint.
Kesalahan umum
printmemerlukan tanda kutip di sekitar teks:print("Hi"), bukanprint(Hi).- Python peka huruf besar-kecil:
Printberbeda denganprint.
Now you try
- Below are a few tasks. Type your code and press Run.
- Press Check answer to see if it is correct.
Sekarang Anda coba
- Di bawah ini ada beberapa tugas. Ketik kode Anda dan tekan Jalankan.
- Tekan Cek jawaban untuk melihat apakah itu benar.
How a program runs · Bagaimana sebuah program berjalan
A program runs top to bottom, one statement at a time. · Sebuah program berjalan dari atas ke bawah, satu pernyataan pada satu waktu.
Use print(...) to make Python show the words Hello, world! exactly (same spelling, same punctuation). · Gunakan print(...) agar Python menampilkan kata-kata Hello, world! secara eksak (ejaan sama, tanda baca sama).
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.
Print two lines. The first line must be My name is Pat. The second line must be I am learning Python. (Use two print(...) calls.) · Cetak dua baris. Baris pertama harus My name is Pat. Baris kedua harus I am learning Python. (Gunakan dua pemanggilan print(...).)
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.
Keep the comment line, then print the number 42. Notice the comment never appears in the output. · Pertahankan baris komentar, lalu print angka 42. Perhatikan bahwa komentar tidak pernah muncul dalam output.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.
Print a box made of three lines: first +-----+, then | Hi! |, then +-----+ again. · Cetak kotak yang terdiri dari tiga baris: pertama +-----+, kemudian | Hi! |, lalu +-----+ lagi.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.