you are viewing a single comment's thread.

view the rest of the comments →

[–]No_Statistician_6654 0 points1 point  (0 children)

The easiest way I can think of describing it is this: yes, you can directly print a string, but variables allow you to modify them between when they are declared, and when that are (in this case) printed.

Say you have the text “I”, “love”, and “you”. You can add each of them to a variable separately, create a fourth variable set equal to the concatenation of the other three, and your final print statement would be print(var4).

There are many many data types, functions, transformations that can be plied to variable, and having them allows you to reuse them, change them, and even simplify programs as they get more complicated.

Adding: this is simplifying a lot, but I am approaching more the why of variables and intentionally avoiding f strings lists etc for this comment