Posts

Python Data Types

  Python supports several data types, each designed for specific purposes. Here are some of the most commonly used data types in Python with examples: Integers ( int ): Integers are whole numbers without a decimal point. Example.   x = 5 y = -10 Floats ( float ): Floats represent real numbers with a decimal point. Example:   3.14159   temperature =   98.5 Strings ( str ): Strings are sequences of characters enclosed in single or double quote.     Example:        "Alice"  ,   'Hello, World!' Lists ( list ): Lists are ordered collections of items, which can be of different data types.  Example:  "apple" ,   "banana" ,   "cherry" ] numbers = [ 1 ,   2 ,   3 ,   4 ,   5 ] Tuples ( tuple ): Tuples are similar to lists but are immutable (cannot be changed after creation). Example       ( 3 ,   4 ) colors = ( "red" ,   "green" ,   "blue" Dictionaries ( ...