Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can see a new instruction in the example above: “str”str. This operation translates the numerical value into a string, so it can be printed to the message window. When there are numbers inside a list, it is possible to extract certain values, assign them as variables, and perform calculations with them – the result is 4.6:

Code Block
themeEclipse
languagepython
linenumberstrue
prices = [3.99 , 1.50 , 2.00 , 0.49 , 1.20 , 2.60]
price_a = prices[2]
price_b = prices[5]
price_total = price_a + price_b
scene.message(str(price_total))