Skip to main content

What is python variable?

Have you ever forgotten a birthday of a friend relative?computers
can hold on to that information if we tell them to.computers use variables to store information? like moving boxes. Variables have content and names that tell us what’s inside. In Python, a variable can be used to store the output of a statement in the computer’s memory.
               
                                           A=23

The equals sign is used to assign a value to a variable.
The name of the variable is called its identifier
   FOR ex. Day = “Monday”


Now anytime we mention the day in our code. the computer will know that we're referring to the value “Monday” inside of it. Because day stored the value Monday

So when we code:- print(day)
                    >>>Monday
The value in double quotes like “Hello world” are strings. They can be any sequence of letters, numbers, and other symbols.

Python variable names must follow the following rules:
*********************
********************
1. They must start with a letter or an underscore

2. They must contain only letters, digits or underscores

Comments

Popular posts from this blog

How to install python 3.0 in your pc??

Installation There are pre-compiled packages made for easy installation on multiple operating systems such as Windows, Linux, UNIX and Mac OS to name but a few. If you head over to https://www.python.org/downloads/ you can select the right installation method for your operating system. Most Linux systems come with Python preinstalled. Version 3 of Python is used in this book. In Windows, once you have installed Python, select Python IDLE or Python command line/console from the Start menu or screen. The difference between the IDLE and the console is that the IDLE has a graphical interface, which looks similar to a text editor. In Linux, UNIX, and OS X, you can launch Python emulator from command line by typing Python. To choose a specific version of Python type PythonX where X is the version number (e.g. “Python3” for version 3). Hello World! Most of the time that you write Python code, you will be writing the script in the IDLE or any other IDE like Eclipse or rich text...

why python??

Why Python? When you embark on your computer science journey at college, you’ll probably start by learning Python. So why choose Python over any other programming language? It’s simple: ·         Regardless of your operating system, Python is easy to set up. ·         Python code uses plain English, making it easy to understand. ·         Python will let you run bad code. ·         Why is this good? ·         When you’re learning you’re bound to make mistakes. ·         Python tells you what the error is after you run the code, helping you to find the ·         problem. ·         Python is a very powerful tool, but it’s also easy and fast to learn, which is why ·   ...