python data type cheatsheet

#Introduction

In this tutorial, we learn about Integers, Lists, Dictionaries, and Tuples. Python data type cheatsheet begins.

python data type cheatsheet

Integers

Integers represent whole numbers. Example

age = 30
rank = 20
image 6

Floats represent decimal numbers. For example,

temperature = 20.2
image 7

Strings represent text. For example

site = "devopsroles.com"
image 8

Lists represent arrays of values that may change during the program

members = ["HuuPV", "no name", "Jack"]
ages_values = [30, 12, 54]
image 9

Dictionaries represent pairs of keys and values:

phone_numbers = {"huupv": "+123456789", "Jack": "+99999999"}

The Keys and values of a dictionary can be extracted

image 10

Tuples

Tuples represent arrays of values that are not to be changed during the program

convert Tuples to list

image 11

 convert the list to a tuple

get a list of attributes of a data type

image 12

get a list of Python built-in functions

python data type cheatsheet

get the documentation of a Python data type

help(str)
help(str.replace)
help(dict.values)

Conclusion

You learn python data type cheatsheet. I hope this will be helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.