Posts

Showing posts with the label variables

Variable & Data Types (Session 3)

 Variable: A variable is a name given to a memory location in a program.  Variables do not need to be declared with any particular  type , and can even change type after they have been set. For example: a = 28 b =21.26 c ="Mustajab" In short, we can say that here variable is a container to store a value . Example: x = 28 y =  "Mustajab" print (x) print (y) Here Mustajab is str type and 28 is int type. Many Values to Multiple Variables: Python allows us to assign values to multiple variables in one line: x, y, z =  "Student1" ,  "Student2" ,  "Student3" print (x) print (y) print (z) Rules for defining a variable name:  A variable name can contain alphabets, digits, and underscore. A variable name can only start with an alphabet and underscore. A variable can’t start with a digit. No white space is allowed to be used inside a variable name. Task : Read about Whitespace Characters in Python. Data Type: Python is a great language that...