Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python fundamental.

Similar presentations


Presentation on theme: "Python fundamental."— Presentation transcript:

1 Python fundamental

2 Python tokens In a passage of text, individual words and punctuation marks are called tokens or lexical units or lexical elements. The smallest individual unit in a program is known as a Token or a lexical unit. Types of tokens:- Keywords Identifiers Literals Operators Punctuators

3 Variables and assignments
A Python variable is a reserved memory location to store values. In other words, a variable in a pythonprogram gives data to the computer for processing. Every value in Python has a datatype. Different data types in Python are Numbers, List, Tuple, Strings, Dictionary, etc. Declare a variable:-We will declare variable "a" and print it.           print a Multiple assignments:- Assigning same value to multiple variables                             Ex: a=b=c=10 2.   Assigning multiple values to multiple variables                             Ex: x,y=10,20

4 Variable defination It means that a variable is not created until some value is assigned to it. In other words you can say that the defination of the variable has to be given before the other operations it is used in. For ex:-(# is for comment not in code) # error code Print(x) X=10 # correct code

5 Dynamic typing When we declare a variable in C or alike languages, this sets aside an area of memory for holding values allowed by the data type of the variable. The memory allocated will be interpreted as the data type suggests. If it’s an integer variable the memory allocated will be read as an integer and so on. When we assign or initialize it with some value, that value will get stored at that memory location. At compile time, initial value or assigned value will be checked. So we cannot mix types. Example: initializing a string value to an int variable is not allowed and the program will not compile. But Python is a dynamically typed language. It doesn’t know about the type of the variable until the code is run. So declaration is of no use. What it does is, It stores that value at some memory location and then binds that variable name to that memory container. And makes the contents of the container accessible through that variable name. So the data type does not matter. As it will get to know the type of the value at run-time.

6 MADE BY:- CHETANYA SHARMA
The end MADE BY:- CHETANYA SHARMA


Download ppt "Python fundamental."

Similar presentations


Ads by Google