This article discuss about how to assign a values to variables.
In Python, assigning values to variables is a fundamental concept. It allows you to store and manipulate data as needed throughout your program. Here is an example of how to assign values to variables in Python:
# Assigning values to variables name = "John" age = 30 is_student = True height = 1.85 # Printing the values of the variables print("Name:", name) print("Age:", age) print("Is Student?", is_student) print("Height:", height)
In the above code, we have assigned values to four different variables: name
, age
, is_student
, and height
. We have assigned a string value to the name
variable, an integer value to the age
variable, a boolean value to the is_student
variable, and a float value to the height
variable.
We have then printed the values of these variables using the print()
function. The output of the above program would be:
Name: John Age: 30 Is Student? True Height: 1.85
By assigning values to variables, you can easily reuse and manipulate data as needed throughout your program.
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.