Python Forum

Full Version: Positive and negative numbers in a row
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I suppose it`s an easy one. I know how to list numbers but struggele how to write a simple function, which will show on the screen alternating positive and negative numbers e.g. 1 -2 3 -4 5 -6. Many thanks in advance.
Can you do 1 2 3 4 5 6? If so, how? Maybe posting that simpler code will provide insight to how you can toggle the sign. How can you change the sign of a number?