Python breaks code into logical components called tokens, which correspond to substrings. There are different token types like identifiers, keywords, operators, and delimiters.
Python has several basic data types including integers, floating point numbers, strings, lists, tuples, and dictionaries. Integers can be positive or negative whole numbers. Floating point numbers have fractional parts. Strings group characters within quotation marks. Lists store comma-separated values in brackets and are mutable. Tuples store values in parentheses and are immutable. Dictionaries store key-value pairs within curly braces and are mutable.
Python breaks code into logical components called tokens, which correspond to substrings. There are different token types like identifiers, keywords, operators, and delimiters.
Python has several basic data types including integers, floating point numbers, strings, lists, tuples, and dictionaries. Integers can be positive or negative whole numbers. Floating point numbers have fractional parts. Strings group characters within quotation marks. Lists store comma-separated values in brackets and are mutable. Tuples store values in parentheses and are immutable. Dictionaries store key-value pairs within curly braces and are mutable.
Python breaks code into logical components called tokens, which correspond to substrings. There are different token types like identifiers, keywords, operators, and delimiters.
Python has several basic data types including integers, floating point numbers, strings, lists, tuples, and dictionaries. Integers can be positive or negative whole numbers. Floating point numbers have fractional parts. Strings group characters within quotation marks. Lists store comma-separated values in brackets and are mutable. Tuples store values in parentheses and are immutable. Dictionaries store key-value pairs within curly braces and are mutable.
Class 12 Science DPS Biratnagar What is Token In general a token is an object that represent something else, such as another object or an abstract concept. Python breaks each logical line into a sequence of elementary lexical components known as Tokens. Each token corresponds to a substring of the logical line. The normal types are identifiers ,keyboards, operators, delimiters and literals. Python data types In programming, datatype is an important concept Variables can store data of different types and different types can do different things. Every value in python has a data type. Since everything is an object in python programming, data types are actually classes and variables are instance of these classes. Integers Integers are whole numbers. They have no fractional parts. Integers can be positive and negative. There are two types of integers in Python. 1)Integers(Signed);it is the normal integer representation of whole numbers using the dights 0 to 9. python provides signal int data type to store any integers. 2)Boolean-these represent the truth values true and false. It is a subtype of integers and Boolean values True and False corresponds to values 1 and 0 respective. Floating point numbers A number having fractional part is a floating point number. It has a decimal point. It is written in two forms; 1)Fractional form: Normal decimal notation 2)Exponent Notation: It has mantissa and exponent Advantages They can represent values between the integers. They can represent a much greater range of values. Disadvantages They are usually slower than integers operations. Strings A string is a group of valid characters enclosed in single or double quotation marks. A string can group any type of known characters i.e. letters, numbers and special and special characters. A python string is a sequence of characters and each character can be accessed by its index either by forward indexing or by backward indexing. List The list is python’s compound data type. A list in python represents a list of comma separated values of any data type between square brackets .Lists are mutable. Tuple The tuple is python’s compound data type. A tuple in python represents s list of comma separated values of any data type within parenthesis .They are Immutable. Dictionaries Dictionaries are unordered collection of elements in curly braces in the Form of a key value pairs that associate keys to values. Dictionary are mutable. As dictionary elements does not have index values the elements are accessed through the keys defined in key value pairs.