Provided by: JetBrains Academy
1 minute read

Do you speak Python?

Given Python's emphasis on simplicity, you're already equipped to understand and recreate basic programs with ease.

Let's create the classic "Hello, World!" program, a friendly greeting from your computer:

print("Hello, world!")

You can replace the phrase within the parentheses to create your own Python program!

Python's built-in functions and methods come with intuitive names, making them easy to grasp. Here's how to use input() to request user data:

age = input("How old are you? ")
print("I know, that you're " + age + " years old")

Python's use of indentation for structure, as opposed to the {} braces or semicolons in many other languages, is another feature you'll find straightforward. Notice how indentation aids in outlining the elements of the if-else statement:

age = input("How old are you? ")
if age > 18:
    print("You're adult")
else:
    print("You're minor")

To boost code comprehension, we can also use #comments. These lines go unexecuted, and describe the code's objective:

# Define a function that acts like a parrot
# Which repeats the things you say back to you
def parrot():
    answer = input()
    print(answer)

# Call the parrot function
parrot()

For now, you don't need to understand how all these lines of code work: appreciate their beautiful syntax that's not too far from everyday English. Don't be afraid to experiment and make mistakes — that's how you learn!

30817 learners liked this piece of theory. 732 didn't like it. What about you?
Report a typo