Python Forum
Positive and negative numbers in a row
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Positive and negative numbers in a row
#1
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.
Reply
#2
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Random Generator: From Word to Numbers, from Numbers to n possibles Words Yamiyozx 2 1,408 Jan-02-2023, 05:08 PM
Last Post: deanhystad
  Convert list of numbers to string of numbers kam_uk 5 2,991 Nov-21-2020, 03:10 PM
Last Post: deanhystad
  insert() but with negative index naughtysensei 1 2,311 Oct-01-2020, 03:05 AM
Last Post: micseydel
  negative indices in lists Ironword 6 3,422 Jan-08-2020, 01:00 PM
Last Post: perfringo
  Question about Sorting a List with Negative and Positive Numbers Than999 2 12,680 Nov-14-2019, 02:44 AM
Last Post: jefsummers
  Regular Expressions in Files (find all phone numbers and credit card numbers) Amirsalar 2 4,094 Dec-05-2017, 09:48 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020