What is a phyton
phyton intro
phyton syntax
comments
Python Variables
100

phyton have a syntax? 

YES

100

Why Python?

  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
100

Execute Python Syntax

As we learned in the previous page, Python syntax can be executed by writing directly in the Command Line:

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

100

Python Comments

Comments can be used to explain Python code.

Comments can be used to make the code more readable.

Comments can be used to prevent execution when testing code.

100

Variables


Variables are containers for storing data values.

200
Python is a computer programming language often used to build websites and software, automate tasks, and conduct data analysis. 





yes

200

Python Syntax compared to other programming languages

  • Python was designed for readability, and has some similarities to the English language with influence from mathematics.
200

Python Indentation


Indentation refers to the spaces at the beginning of a code line.

200

Creating a Comment

Comments starts with a #, and Python will ignore them:

200

Creating Variables

Python has no command for declaring a variable.

A variable is created the moment you first assign a value to it.

300

By who is created phyton

 Guido van Rossum

300

It is used for:

  • web development (server-side),
  • software development,
  • mathematics,
  • system scripting.
300

Comments

Python has commenting capability for the purpose of in-code documentation.

300

Multi Line Comments

Python does not really have a syntax for multi line comments.

To add a multiline comment you could insert a # for each line:

300

Casting

If you want to specify the data type of a variable, this can be done with casting.

400

released in

1991

400

What can Python do?

  • Python can be used on a server to create web applications.
400

Example

#This is a comment.
print("Hello, World!")

Try it Yourself »


400

A comment does not have to be text that explains the code, it can also be used to prevent Python from executing code:

Example

#print("Hello, World!")
print("Cheers, Mate!")

400

Get the Type


You can get the data type of a variable with the type() function.


500

What can Python do?

  • Python can be used on a server to create web applications.
500

Good to know

  • The most recent major version of Python is Python 3, which we shall be using in this tutorial. However, Python 2, although not being updated with anything other than security updates, is still quite popular.
500

Example

Syntax Error:

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

500

Or, not quite as intended, you can use a multiline string.

Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it:

This is a comment
written in
more than just one line
"""
print("Hello, World!")

Try it Yourself »


500

Single or Double Quotes?

String variables can be declared either by using single or double quotes: