top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Arrays in Python

Writer: Marehan RefaatMarehan Refaat

The idea of arrays comes from that we have multiple variables of the same type and we want to put them together like this

name1 = 'Ahmed'
name2 = 'Ali'
name3 = 'Manar'

We put them in one array called "names"

names = ['Ahmed','Ali','Manar']

Access the Elements of an Array

You refer to an array element by referring to the index number.

x = names[1]
print(x)
Ali

Modify a value in the array

names[0] = "John"
print(names)
['John', 'Ali', 'Manar']

The Length of an Array

Use the len() method to return the length of an array (the number of elements in an array).

x = len(names)
print(x)
3

Looping Array Elements

You can use the for in loop to loop through all the elements of an array.

for i in names:
  print(i)
John
Ali
Manar

Adding Array Elements

You can use the append() method to add an element to an array.

names.append("Hoda")
print(names)
['John', 'Ali', 'Manar', 'Hoda']

Removing Array Elements

You can use the remove() method to remove an element from the array.

names.remove("Hoda")
print(names)
['John', 'Ali', 'Manar']

You can refer to the code form here 

Comentários


COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page