0

What are variable placeholders

Day one of learning no prior experience

14th Feb 2022, 10:27 AM
Patrick LeBel
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.
14th Feb 2022, 10:32 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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
14th Feb 2022, 10:53 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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
14th Feb 2022, 11:08 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
So lost I'm on lesson one and it's talking about eggs and spam and your talking about math???
14th Feb 2022, 10:35 AM
Patrick LeBel