Program to append a variable in Python
In this python programs guide, we will learn to write:
-
program to append variable in python
Program to append variable in Python
The code to append a variable in Python is as follows:
# Owner : TutorialsInhand Author : Devjeet Roy
age = 34
age = int(input("Enter your age: "))
print("Your age is",age)
The output is :
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter your age: 23
Your age is 23
Few important points about this program:
1. Appending in programming means changing the value of a variable and reassigning some other value to it. Here, we appended the variable age to change its value from 34 to 23.
2. We can take user input in Python using the input() function. But that input which is taken by the input() function is in string format. We can convert it to an integer type by using the int() function.
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :
Published Date :
Jan 19,2021