Python

Python Menu

The first program you write in a new language is usually called Hello, World! And all it does is display "Hello, World!" phrases. It looks like this in Python:

>>> print('Hello, World!')

This is an example of a print statement, although it doesn’t actually print anything on paper. It displays a result on the screen. In this case, the result is the words "Hello, World!"

The quotation marks in the program mark the beginning and end of the text to be displayed; they don’t appear in the result.

Exercise

Use the "print" function to print the line "Hello, World!".

print("Goodbye, World.") print("Hello, World!") test_output_contains("Hello, World!",no_output_msg= "Make sure to print Hello, World!") success_msg("Great job!")

Indentation

Python uses indentation for blocks, instead of curly braces. Both tabs and spaces are supported, but the standard indentation requires standard Python code to use four spaces. For example:

if 5 > 2: print("Five is greater than two!")

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods