Cheatography
https://cheatography.com
Python Comments
Example 1 #This is a comment
|
Example 2 #This is a comment #written in #more than just one line
|
Example 3 """ This is a comment written in more than just one line """
|
Python Variables
#code x = "How old are you ?" #x is of type str print(x) #output >>> How old are you ? #code x = 25 #x now is of type int print(x) #output >>> 25
|
Python Data Types
Text Type: |
|
Numeric Types: |
|
Sequence Types: |
|
Mapping Type: |
|
Set Types: |
|
Boolean Type: |
|
Binary Types: |
bytes, bytearray, memoryview
|
Get the data type of a variable "var" |
|
|
|
Python Data Types Examples
Example |
Data Type |
|
|
|
|
|
|
|
|
x = ["Blue","Red","Yellow"]
|
|
x = ("Blue","Red","Yellow")
|
|
|
|
x={"Age":25,"Height":1.72}
|
|
|
|
x = frozenset({"Pink","Red"})
|
|
|
|
|
|
|
|
x = memoryview(bytes(8))
|
|
Get the data type of x : |
x = "Color" print(type(x)) >>> str
|
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by Nouha_Thabet