Programming

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

Floats represent decimal numbers. For example,

temperature = 20.2

Strings represent text. For example

site = "devopsroles.com"

Lists represent arrays of values that may change during the program

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

Dictionaries represent pairs of keys and values:

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

The Keys and values of a dictionary can be extracted

Tuples

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

convert Tuples to list

 convert the list to a tuple

get a list of attributes of a data type

get a list of Python built-in functions

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!

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.