Python Variables

Python Variables 

Variables:

They are containers for holding data values. It will help you store the value in a memory location.

example:
cost = 10
print(cost)

Now cost variable will direct you to get the information stored over the memory location which is holding the data 10.

Variables help you to create formulas or help to reuse the data over different locations in a code.

example:
cost=10
tax_percent = 0.25
tax = cost * tax_percent
price = cost I+ tax

print(price)

String datatype variable sample:
username="Rock!rupesh"
first_name="Rahul"

print(username)
print(first_name)
print(username + " " + first_name)

first_number=10
second_number=2

print(first_number)
print(second_number)
first_number=1

So you can modify the variable stored information according to your need.

So as a summary variables are memory location which hold relevant information for your application.

Comments

Popular posts from this blog

Post Request with Pydantic usage (input validator)

Code Scalability and Routing

CRUD Assignment