Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ONE input => THREE outputs
#4
(Jan-12-2021, 01:11 PM)DeaD_EyE Wrote: It looks silly, but works:
pos0 = pos1 = pos2 = input()
another way:
pos0 = input()
pos1 = pos0
pos2 = pos0
If you change the value of pos0, pos1 and pos2 won't change.

Think you just need to be a little careful - your alternative option works great for scalar variables but with lists, objects (and I think tuples as well) this will cause issues as this copies the position reference of the variable and not the value of the variable

Kind regards
RF
Reply


Messages In This Thread
ONE input => THREE outputs - by Tricia279 - Jan-12-2021, 01:05 PM
RE: ONE input => THREE outputs - by DeaD_EyE - Jan-12-2021, 01:11 PM
RE: ONE input => THREE outputs - by RubenF85 - Jan-12-2021, 03:25 PM
RE: ONE input => THREE outputs - by Tricia279 - Jan-14-2021, 07:42 AM
RE: ONE input => THREE outputs - by perfringo - Jan-14-2021, 08:52 AM
RE: ONE input => THREE outputs - by buran - Jan-12-2021, 01:45 PM
RE: ONE input => THREE outputs - by DeaD_EyE - Jan-12-2021, 07:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  format json outputs ! evilcode1 3 1,779 Oct-29-2023, 01:30 PM
Last Post: omemoe277
  Formatting outputs created with .join command klairel 2 655 Aug-23-2023, 08:52 AM
Last Post: perfringo
  I have written a program that outputs data based on GPS signal kalle 1 1,201 Jul-22-2022, 12:10 AM
Last Post: mcmxl22
  Why does absence of print command outputs quotes in function? Mark17 2 1,416 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Thoughts on interfacing with a QR code reader that outputs keystrokes? wrybread 1 1,507 Oct-08-2021, 03:44 PM
Last Post: bowlofred
  Combining outputs into a dataframe rybina 0 1,700 Mar-15-2021, 02:43 PM
Last Post: rybina
  Multi set string inputs/outputs kwmcgreal 2 2,104 Sep-26-2020, 10:44 PM
Last Post: kwmcgreal
  How to use subprocess to get multiple data outputs in desired folder? 3SG14 1 2,254 Sep-19-2020, 05:46 PM
Last Post: bowlofred
  Outputs missing SamAnw 4 2,671 Feb-12-2020, 04:32 PM
Last Post: adetheheat
  Interpreter and running a .py file give different outputs PythonNPC 5 3,090 Jul-21-2019, 01:07 PM
Last Post: PythonNPC

Forum Jump:

User Panel Messages

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