Movatterモバイル変換


[0]ホーム

URL:


Open In App
Next Article:
Python 3 basics
Next article icon

Python was created by Guido van Rossum in 1991 and further developed by the Python Software Foundation. It was designed with focus on code readability and its syntax allows us to express concepts in fewer lines of code.

Key Features of Python

Understanding Hello World Program in Python

Hello, World! in python is the first python program which we learn when we start learning any program. It’s a simple program that displays the message “Hello, World!” on the screen.

print-hello-world
Hello World Program

Here’s the “Hello World” program:

Python
# This is a comment. It will not be executed.print("Hello, World!")

Output
Hello, World!

How does this work:

  • print() is a built-in Python function that tells the computer to show something on the screen.
  • The message "Hello, World!" is a string, which means it's just text. In Python, strings are always written inside quotes (either single ' or double ").
  • Anything after # in a line is a comment. Python ignores comments when running the code, but they help people understand what the code is doing.
  • Comments are helpful for explaining code, making notes or skipping lines while testing.

We can also write multi-line comments using triple quotes:

Python
"""This is a multi-line comment.It can be used to describe larger sections of code."""

To understand comments in detail, refer to article:Comments.

Indentation in Python

In Python, Indentation is used to define blocks of code. It tells the Python interpreter that a group of statements belongs to a specific block. All statements with the same level of indentation are considered part of the same block. Indentation is achieved using whitespace (spaces or tabs) at the beginning of each line. The most common convention is to use 4 spaces or a tab, per level of indentation.

Example:

Python
print("I have no indentation")print("I have tab indentaion")

Output:

Hangup (SIGHUP)
File "/home/guest/sandbox/Solution.py", line 3
print("I have tab indentaion")
IndentationError: unexpected indent

Explanation:

  • firstprintstatement has no indentation, so it is correctly executed.
  • secondprintstatement hastab indentation, but it doesn't belong to a new block of code. Python expects the indentation level to be consistent within the same block. This inconsistency causes anIndentationError.

To understand Indentation in detail, refer to article:Indentation

Famous Application Built using Python

  • YouTube: World’s largest video-sharing platform uses Python for features like video streaming and backend services.
  • Instagram: This popular social media app relies on Python’s simplicity for scaling and handling millions of users.
  • Spotify: Python is used for backend services and machine learning to personalize music recommendations.
  • Dropbox: The file hosting service uses Python for both its desktop client and server-side operations.
  • Netflix:Python powers key components of Netflix’s recommendation engine and content delivery systems (CDN).
  • Google: Python is one of the key languages used in Google for web crawling, testing and data analysis.
  • Uber: Python helps Uber handle dynamic pricing and route optimization using machine learning.
  • Pinterest: Python is used to process and store huge amounts of image data efficiently.

What can we do with Python?

Python is used for:


Python Introduction
Visit Courseexplore course icon
Video Thumbnail

Python Introduction

Video Thumbnail

How Python Programs are Executed

Video Thumbnail

Python Programming Terminology

Video Thumbnail

Python Installation and First Program

Video Thumbnail

Comments in Python

Video Thumbnail

Variables in Python

Improve
Article Tags :
Practice Tags :

Similar Reads

We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood ourCookie Policy &Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences

[8]ページ先頭

©2009-2025 Movatter.jp