Why not just put my name in the string?

Couldn’t we just put our name within the print program as opposed to a different line?

9 Likes

Well, that would not be following the instructions to the letter, which you might find around here goes a long way to a good learning experience.

The lesson shows us how a variable can be assigned with a value, then interpolated into a string and outputed to the console.

There are a number of concepts demonstrated…

  1. strings
  2. variables
  3. assignment
  4. concatenation
  5. printing
27 Likes

Thanks Roy! I’m a beginner and just wanted to be the guy to ask questions about everything for better understanding. Kind of self-teaching/ learning this stuff, not the easiest task.

26 Likes

With more experience the usefulness of this will become understood. It’s a small part of a bigger picture.

4 Likes

Is it necessary to write a variable as my_name, can’t we write like my name?

@giga0346789029, variable names, among other constraints, must include no spaces.

2 Likes

Thanks for help, it means a lot.

Good question for a newbie programmer, the answer would be… best to use variables sometimes for programs. imagine the script is much longer and your name appears at other areas. instead of updating all those lines of code you just update the variable at the top. It would save time and cascade to the rest of the code.

4 Likes