0
What are variable placeholders
Day one of learning no prior experience
4 ответов
+ 1
Typically, a placeholder is assigned to a variable to return a preset value.
An example:
pi = 3.14
This could be used as a place holder for the math of the code, but pi could be re-assigned to 3.141592 for increased accuracy.
+ 1
Patrick LeBel
Spam & Eggs?
I assume you are learning Python.
Please share which lesson so I may review and try to explain further.
Also, which course EXACTLY
+ 1
Patrick LeBel
I found this definition on Google
"A placeholder is simply a variable that we will assign data to at a later date."
I saw a reference to this in Python Core, lesson 1.1
In your lesson, spam & eggs are used as placeholders to show the effect of the variable.
The use of these words in Python is to signify to the user that the value of the variable is a placeholder, which will possibly be re-assigned later.
Another example of a placeholder is when you wish to do a math problem and assign the result to a variable.
(yep, math again)
result = 0 #this is the placeholder
a = 7
b = 8
result = a+b # re-assigned
print(result) # 15
0
So lost I'm on lesson one and it's talking about eggs and spam and your talking about math???