Skip to main content
Informatik.uz
Chapter 1. Python Basics

Your First Python Program

Python is an easy-to-learn and widely used programming language. We learn to print text, read input from the user and write comments, and then write our first program.

Topic 1 of 111 min readUpdated October 27, 2026
All topics (1 of 11)

Python is an easy-to-learn and widely used programming language. It was created by Guido van Rossum, and its first version appeared in 1991. Today Python is used to build websites, analyze data, create artificial intelligence and automate tasks.

To write programs you need a Python interpreter and a text editor. For beginners, IDLE, which is usually installed together with Python, or Thonny is convenient. The interpreter carries out the commands of the program one after another, from top to bottom.

The very first program prints text on the screen: print("Salom, dunyo!"). Here print is the output function, and the text in quotation marks inside the parentheses is called a string. When the program runs, the words Salom, dunyo! (“Hello, world!” in Uzbek) appear on the screen, and the quotation marks are not shown.

To get data from the user, the input() function is used: name = input("Ismingiz nima? "). The entered name can be printed with the command print("Salom,", name). Python distinguishes uppercase and lowercase letters, so writing Print causes an error. Text after the # sign is a comment and does not affect how the program works: # Greeting program.

Key takeaways

  • Python is an easy-to-learn and widely used programming language.
  • The print() function outputs data to the screen, and input() gets data from the user.
  • Text (a string) is written in quotation marks.
  • Python distinguishes uppercase and lowercase letters.
  • A comment starts with the # sign and is not executed.

Practice tasks

  1. Open a Python environment (IDLE or Thonny), type in and run the program print("Salom, dunyo!"); then change print to Print and see what message appears.
  2. Write a program that prints your name and your class on two lines; use two print() commands.
  3. Use input() to ask the user for a name and greet them by name; write a comment at the beginning of the program.

Review questions

Test yourself: think first, then reveal the answer.

  1. 1What does the print() function do?
    It outputs text or other data to the screen.
  2. 2Which sign is used to write a comment in Python?
    The hash sign (#); a comment does not affect how the program runs.
  3. 3Why does the command Print("Salom") cause an error?
    Python distinguishes uppercase and lowercase letters, and there is no function called Print.

0 of 11 topics completed

Sign in to mark
Informatika 9-sinf darsligi muqovasi
In the textbookInformatics — Grade 9