how to declare a string variable in python code example
Example 1: how to use variables in string in python
x = 2
y = f'This is a string using variable x: {x}'
print(y)
Example 2: how to create a variable in python
variable1 = "value"
variable2 = 1000000
variable3 = 10000.0
variable4 = True
Example 3: variables in python
x = 5
y = "John"
print(x)
print(y)
Example 4: variable string in string python
>>> shepherd = "Mary"
>>> age = 32
>>> stuff_in_string = "Shepherd {} is {} years old.".format(shepherd, age)
>>> print(stuff_in_string)
Shepherd Mary is 32 years old.