Python Handwritten Notes<\/a> Pdf.<\/p>\nBasics of Python \u2013 Variable, Identifier and Literal<\/h2>\n Variable, identifier, and literal<\/strong><\/p>\nA variable is a storage location that has an associated symbolic name (called “identifier”), which contains some value (can be literal or other data) that can change. An identifier is a name used to identify a variable, function, class, module, or another object. Literal is a notation for constant values of some built-in type. Literal can be string, plain integer, long integer, floating-point number, imaginary number. For e.g., in the expressions<\/p>\n
var1=5 \r\nvar2= 'Tom'<\/pre>\nvar1 and var2 are identifiers, while 5 and ‘ Tom’ are integer and string literals, respectively.<\/p>\n
Consider a scenario where a variable is referenced by the identifier a and the variable contains a list. If the same variable is referenced by the identifier b as well, and if an element in the list is changed, the change will be reflected in both identifiers of the same variable.<\/p>\n
>>> a = [1, 2, 3]\r\n>>> b =a \r\n>>> b \r\n[1, 2, 3]\r\n>> a [ 1 ] =10\r\n>>> a\r\n[1, 10, 3]\r\n>>> b\r\n[1, 10, 3]<\/pre>\nNow, the above scenario can be modified a bit, where a and b are two different variables.<\/p>\n
>>> a= [1,2,3 ]\r\n>>> b=a[:] # Copying data from a to b.\r\n>>> b \r\n[1, 2, 3]\r\n>>> a [1] =10 \r\n>>> a \r\n(1, 10, 3]\r\n>>> b\r\n[1, 2, 3]<\/pre>\nThere are some rules that need to be followed for valid identifier naming:<\/p>\n
\nThe first character of the identifier must be a letter of the alphabet (uppercase or lowercase) or an underscore (‘_’).<\/li>\n The rest of the identifier name can consist of letters (uppercase or lowercase character), underscores (‘_’), or digits (0-9).<\/li>\n Identifier names are case-sensitive. For example, myname and myName are not the same.<\/li>\n Identifiers can be of unlimited length.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"In this Page, We are Providing Basics of Python \u2013 Variable, Identifier and Literal. Students can visit for more Detail and Explanation of Python Handwritten Notes Pdf. Basics of Python \u2013 Variable, Identifier and Literal Variable, identifier, and literal A variable is a storage location that has an associated symbolic name (called “identifier”), which contains …<\/p>\n
Basics of Python \u2013 Variable, Identifier and Literal<\/span> Read More »<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[5],"tags":[],"yoast_head":"\nBasics of Python \u2013 Variable, Identifier and Literal - Python Programs<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n