1-Amaliy: Python dasturida birinchi kod yozish
Python 3 da satrni chop etish uchun shunchaki yozing:
print("Ushbu qator chop etiladi.")
test_function("print")
success_msg("To'g'ri javob!")
Python bloklar uchun jingalak qavslar o'rniga chekinishdan foydalanadi. Ikkala yorliq va bo'shliqlar qo'llab-quvvatlanadi, ammo standart chekinish to'rtta bo'sh joydan foydalanish uchun standart Python kodini talab qiladi. Masalan:
x = 1
if x == 1:
# indented four spaces
print("x is 1.")
test_function("print")
success_msg("To'g'ri javob!")
“Salom, dunyo!” qatorini chop etish uchun “chop etish” funksiyasidan foydalaning.
print("Salom, Xayot!")
print("Salom, dunyo!")
test_function("print")
test_function("Salom, dunyo!")
success_msg("To'g'ri javob!")