My Hyperskill
Study anywhere, anytime Get
GET - On the Google Play
Computer science → Programming languages → Python →
Basics → Simple programs
Skip topic Go to practice
Introduction to Python
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:
1 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:
1 age = input("How old are you? ")
2 print("I know, that you're " + age + " years o
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:
1 age = input("How old are you? ")
2 if age > 18:
3 print("You're adult")
4 else:
5 print("You're minor")
To boost code comprehension, we can also use #comments .
These lines go unexecuted, and describe the code's
objective:
1 # Define a function that acts like a parrot
2 # Which repeats the things you say back to you
3 def parrot():
4 answer = input()
5 print(answer)
6
7 # Call the parrot function
8 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!
Start practicing
30823 learners liked this piece of theory. 732 didn't like it. What
about you?
Comments (215) Useful links (10) Show discussion
Languages Career paths Subjects
Python Web Dev AI Coding Tools
Java Backend ✨ AI Engineering
Kotlin & Android DevOps ML & Math
SQL and left
7 / 7 lives Databases Data Science & Analysis Get Premium
Go & C++ Early Access
Drafts
Full catalog
Resources Hyperskill
Blog About
University Careers
Guide For Content Creators
Bootcamps
Become beta tester
Support
Subscription Help Center Be the first to see what's new
For Business Contact Support
Pricing Terms