# python 3 Cheat Sheet 2020 for Beginners

In this Tutorial You will learn about python in detail . In this Era python is mostly used. Python is a precious language. It is easy to learn, and its syntax is too simple.Most of People Wondering how to Learn python. Python is important for beginners. In this tutorial You will Learn complete python Via Chat sheet

1. Primitives:

Numbers

Python has integers and floats. Integers are simply whole numbers, like 314, 500, and 716. Floats are fractional numbers like 3.14, 2.877, 76.9987.

type(3)
<type ‘int’>
>>> type(3.14)
<type ‘float’>
>>> pi = 3.14
>>> type(pi)
<type ‘float’>

In this example, pi is the variable name, while 3.14 is the value.
By mathematical operators:

>>> 3+3
6
>>> 3-3
0
>>> 3/3
1
>>> 3*3
9
>>> 3**3
27
>>> num = 3
>>> num = num – 1
>>> print num
2
>>> num = num + 10
>>> print num
12

Strings:

Strings are used quite often in Python. Strings, are just that, a string of characters.Python recognizes single and double quotes as the same thing, the beginning and ends of the strings.

>> “string list”
‘string list’
>>> ‘string list’
‘string list’

Now you can also join strings with use of variables as well.

>> a = “first”
>>> b = “last”
>>> a + b
‘firstlast’

Booleans:

Boolean values are simply True or False .Check to see if a value is equal to another value with two equal signs.

>> 10 == 10
True
>>> 10 == 11
False
>>> “jack” == “jack”
True
>>> “jack” == “jake”
False

2. Collections

Lists:-

Lists are containers for holding values.

>> fruits = [‘apple’,’lemon’,’orange’,’grape’]
>>> fruits
[‘apple’, ‘lemon’, ‘orange’, ‘grape’]

Dictionaries:-

A dictionary optimizes element lookups. It uses keys and values, instead of numbers as placeholders. Each key must have a value. You can used a word to look up a value.

>> words={‘apple’:’red’,’lemon’:’yellow’}
>>> words
{‘lemon’: ‘yellow’, ‘apple’: ‘red’}
>>> words[‘apple’]
‘red’
>>> words[‘lemon’]
‘yellow’

3. Control Statements

IF Statements:-

The IF statement is used to check if a condition is true. if the condition is true, the Python interpreter runs a block of statements called the if-block. If the statement is false, the interpreter skips the ifblock and processes another block of statements called the else-block. The else clause is optional.
Let’s look at two quick examples.

>> num = 20
>>> if num == 20:
… print ‘the number is 20’
… else:
… print ‘the number is not 20’

the number is 20
>>> num = 21
>>> if num == 20:
… print ‘the number is 20’
… else:
… print ‘the number is not 20’

the number is not 20