0

what is place holder variable??

14th Jul 2022, 11:14 PM
TAIWO OLANREWAJU OLUWATOSIN
TAIWO OLANREWAJU OLUWATOSIN - avatar
1 Antwort
+ 2
It is when you create a variable with a value that you expect to change later. Example: lst = [3,8,2,6,1,4] result = lst[0] # placeholder for num in lst: if num > result: result = num # re-assignment print(result) # result will show the largest number in the list
14th Jul 2022, 11:53 PM
Rik Wittkopp
Rik Wittkopp - avatar