top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Writer's pictureYosef Zeru Seyoum

Python Lists

Introduction

Python is one of the world's most widely held programming languages, and the reason behind its popular acceptance includes, not limited to:

· Use of simple and intuitive syntax which resembles to simple English

· Python is object-oriented programming language, everything in python considered as an object with different characteristics. Python allows working on various objects.

· Python has features to integrated with different software or components of a software for data cleaning, analysis, and interpretation.

Lists

There are four built-in data types in python, namely Lists, Tuples, Sets and Dictionaries. Lists are mainly used to store multiple items in a single variable.

- Lists are prepared placing all data elements in a square bracket which are separated by comma.

- Single list can contain different data types like float, integer, or string.

- We can place lists inside the list, and it is called nested list.

Example of creating empty list


#Empty List
Departments = []

Example of creating a list containing string values



#List Containing departments In the Hospital
Departments = ["OutPatient", "Inpatient", "Dermatology", "STI", "Surgical", "Onchology", "Optalmology"]
print