Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python Programming Lecture II. Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive.

Similar presentations


Presentation on theme: "Python Programming Lecture II. Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive."— Presentation transcript:

1 Python Programming Lecture II

2 Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive datatypes” –integer –real numbers –strings –boolean What are the distinguishing features of these different kinds of data?

3 Variables Data is stored in the memory cells of your computer. A variable is a reference to a specific cell somewhere in the computer’s memory that holds some data. In some computer languages a variable must match the type of data that it points to. –integer variable –boolean variable –string variable etc. Any attempt to assign the wrong type of data to such a variable will cause an error.

4 Static Typing Some programmers prefer this type of system, known as static typing because it can prevent some subtle bugs which are hard to detect. However, Python variables are not like this, they are dynamically typed. This means that the variable takes the type of value that is assigned to it.

5 Dynamic Typing >>> q = 7 # q is now a number >>> print q 7 >>> q = "Seven" # reassign q to a string >>> print q Seven Variables typically appear as syntactically distinguished items in programming language. In Python they must begin with an alphanumeric character and may include underscore

6


Download ppt "Python Programming Lecture II. Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive."

Similar presentations


Ads by Google