Python (Level-3): Data Types

Python

Important Primitive Data Types.

Python provides a wide variety of primitive data types. Among them, data types such as List, Tuple, Dictionary, and Set are the most essential parts of Python.

- String, List, Tuple, Dictionary, and Set


String(in detail)

Let's have a look the string data type in detail

5. Let's take a look at String data type in detail.

String data types is really important because chatting is done through words(writing).
Let's study followings.
- string literals
- string formatting
- string operations

string data type_1



Let's take a closer look at the indexing of strings.

string data type_2



Let's take a look at string-related member functions.
- It's about a 'class' you haven't learned yet, but...

string data type_3


- This is a class-related explanation, 
but the function has not yet been explained in detail... 
so it can be a little difficult to understand.
Let's remember one thing.
- In Python, everything is an object, followed by functions 
that can manipulate the object.

EchoBot_02



List

A list is created by placing elements inside square brackets [] , separated by commas. A list can have any number of items and they may be of different types (integer, float, string, etc.). A list can also have another list as an item. 


What is a list?

list slicing

list operations


#### [Self-Practice ] ###

list copy_01

list copy_02

list processing using for

mutable

list comprehension

generator_expression


Tuple, Dictionary, Set

A tuple is a collection which is ordered and unchangeable.

tuple


Dictionaries are used to store data values in key:value pairs and it is a collection which is ordered, changeable and do not allow duplicates.

dictionary


Sets are used to store multiple items in a single variable. A set is a collection which is unordered, unchangeable(can add or remove items), and un-indexed.

set


The process of converting the value of one data type to another data type is called type conversion. Python has two types of type conversion.

- Implicit Type Conversion
- Explicit Type Conversion


ChatBot Examples

chatbot_01

chatbot_02

chatbot_03

chatbot_04

chatbot_05

Comments

Popular posts from this blog

Processing Language(Level-1): Game Coding.