1 / 8

Data Types in Python part-2

This Presentation educate you about Data Types in Python, Base conversion, Boolean in python with basic program input and Strings in Python.

Download Presentation

Data Types in Python part-2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Types in Python Swipe

  2. Data Types in Python Fundamentals Derived Suite Integers List Numbers Float Tuple Complex Range Sequence Boolean Bytes String Bytes Arrays Sequence None Set Frozen Set Mapping Dictionary

  3. Base conversion To convert any number from binary, octal, hexadecimal to decimal value just assign the value to a variable with corresponding prefixed and peint it. It will give you decimal equivalent of that number. Bin(X) Here argument (x) can be a decimal, octal or hexadecimal value anything oct(X) Basic Conversion hex(X)

  4. Boolean Data type with one of the two built-in values, True or False. Boolean objects that are equal to True are truthy (true). But non-Boolean objects can be evaluated in Boolean context as well and determined to be true or false. It is denoted by the class bool. # Python program to # demonstrate boolean type print(type(True)) print(type(False)) print(type(True))

  5. Boolean Data Type in Python Note – True and False with capital ‘T’ and ‘F’ are valid booleans otherwise python will throw an error. Boolean in python True False True - 1 False - 0 - Except 0 everything is true - Except empty string everything is true

  6. Strings in Python In Python, Strings are arrays of bytes representing Unicode characters. A string is a collection of one or more characters put in a single quote, double-quote or triple quote. In python there is no character data type, a character is a string of length one. It is represented by str class.

  7. Strings in Python Combination of characters kept inside single/double/triple quotes. Triple quotes are used to -To define multiline string, -To define docstring. -To comment multiple lines. Strings Indexing - str[index] Slicing - [start:end:step] Few basic operation on string. -Concatenation. -Repetition.

  8. Topics for next Post Data Types in Python Mutable vs Immutable Data type in Python Stay Tuned with

More Related