More items are not a memorable place to store the value of the price. This means when creating a change and saves a little memory.
According to the nature of the transaction, the interpreter memorizes the memory and decides what to save for the memory. Therefore, by typing in different types of data and variables, you can store studies, decimals or characters in these variables.
Assessing the value of the variables
Python variables do not require clear evidence of the protection of memory space. The declaration will automatically fall when you write a variable value. The same symbol (=) is used to name the value of the variables.
The left side of the task = is the name change and the correct operation of the operator = is the value stored in the variable. For example –
#!/usr/bin/python counter = 100 # An integer assignment miles = 1000.0 # A floating point name = "John" # A string print counter print miles print name
Here, 100, 1000.0 and “John” are the value of the swelling, the shaft, and the change, respectively. This produces the following results –
100 1000.0 John
Multiple Assignment
Python will allow you to set up a combination of unit price at the same time. For example –
a = b = c = 1
Here, the item is set to a fixed value of 1, all three variables are allocated to the same memory. You can also select several items for several variables. For example –
a,b,c = 1,2,”john”
Here, all two items with a value of 1 and 2 assigned to the variables and b respectively, and the value of the string “John” are assigned to c variable.
Standard Data Types
Data stored in memory can be many types. For example, the age of the person is stored at a high value and their address is stored in the alphanumeric format. Python has a lot of wet data used to determine how the operation can be in stores and methods.
Python has five types of data –
- Numbers
- String
- List
- Tuple
- Dictionary
Python numbers
Types of data stored in numbers. the number of objects created when the value is recorded. For example –
var1 = 1 var2 = 10 You can also delete the reference reference by using the instructions. The word phrase came from - del var1[,var2[,var3[....,varN]]]] You can delete one item or a few items using the instructions. For example - del var del var_a, var_b
Python supports four different types of numbers –
- int (signed integers)
- long (long integers, can also be shown in eighteen)
- Float(Float point real values)
- Complex (Complex numbers)
- Python allows you to use a lowercase l with a long, but it is recommended that you only use the letters to avoid confusion with the number 1. Showing Python long integers with a capital L.
- The number of A centered coupled with a real number is a hard-point, x + yj, where x and y is the actual number and j are the imaginative unit.
Python strings
Python links are identified as natural diagrams of the statements. Python allows both of them to be one or two. The chain can be downloaded using a slider ([] and []) and from the beginning of the string and can be used as a starting point to end.
The extra sign (+) signates the chain of sms with an asterisk (*) is the repetitive operator. For example –
#!/usr/bin/python str = 'Hello World!' print str # Prints complete string print str[0] # Prints first character of the string print str[2:5] # Prints characters starting from 3rd to 5th print str[2:] # Prints string starting from 3rd character print str * 2 # Prints string two times print str + "TEST" # Prints concatenated string
Python List
List the most common types of Python in the data. The list consists of split pieces that are attached to the back cover ([]). To some extent, they are similar to the tests in the C. The ratio between them is the complete list of products to be a different type of data.
The value of the list can be found using a slider ([] and []) and the beginning of the 0 starting list and can be used to stop the path -1. Additional signatures (+) sign up for the baseline list, and the star (*) operator repeated. For example –
#!/usr/bin/python list = [ 'abcd', 786 , 2.23, 'john', 70.2 ] tinylist = [123, 'john'] print list # Prints complete list print list[0] # Prints first element of the list print list[1:3] # Prints elements starting from 2nd till 3rd print list[2:] # Prints elements starting from 3rd element print tinylist * 2 # Prints list two times print list + tinylist # Prints concatenated lists This produces the following results
['abcd', 786, 2.23, 'john', 70.2] abcd [786, 2.23] [2.23, 'john', 70.2] [123, 'john', 123, 'john'] ['abcd', 786, 2.23, 'john', 70.2, 123, 'john']
Python Tuples
Tuple is another type of data series that comes from the same device. Tuple consists of several values that distinguish the rectum. However, in the list, however, the thieves rely on the courses.
The main difference between the tuples and the list is the attached list of square ([]) and the size of the size that can be changed while the tuples are attached to the parentheses (()) which can not be changed. The tubes can be considered as a list of only. For example –
#!/usr/bin/python tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 ) tinytuple = (123, 'john') print tuple # Prints complete list print tuple[0] # Prints first element of the list print tuple[1:3] # Prints elements starting from 2nd till 3rd print tuple[2:] # Prints elements starting from 3rd element print tinytuple * 2 # Prints list two times print tuple + tinytuple # Prints concatenated lists
Python Dictionary
The Python dictionary is a form of symmetrical tables. They work like the same or poultry machines in Perl and produce Key values. The dictionary can open all types of Python, but often numbers or letters. Value, On the other hand, there could be something that is not suitable for Python.
Dictionary are attached to the knee {{}} and are evaluated and used with criteria ([]). For example
#!/usr/bin/python dict = {} dict['one'] = "This is one" dict[2] = "This is two" tinydict = {'name': 'john','code':6734, 'dept': 'sales'} print dict['one'] # Prints value for 'one' key print dict[2] # Prints value for 2 key print tinydict # Prints complete dictionary print tinydict.keys() # Prints all the keys print tinydict.values() # Prints all the values
Data type Conversion
Sometimes you may need to interact between the types of structure. To change the types, simply use the type name as an action.
There are several techniques created to create one kind of data from another. These jobs will return a new product representing the changed value.
To getting expect level training for Python training in your Location – Python Training in Chennai | Python Training in Bangalore | Python Training in Pune | Python Training institute in Chennai | Python Interview Questions And Answers | python training in sholinganallur