Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ONE input => THREE outputs
#7
(Jan-14-2021, 07:42 AM)Tricia279 Wrote: => thank you for your inspiration, I made it with a variable:
var = input()
pos0 = var
pos1 = var
pos2 = var
Smile

I hope that you do realize that this will not deliver result(s) you defined in your initial post. You wanted int but this will deliver str.

To illustrate problem and provide alternative using dictionary:

>>> initial = input('Enter initial value: ')
Enter initial value: 160
>>> initial
'160'
>>> positions = dict.fromkeys((0, 1, 2), initial)    # range(3) can be used instead of (0, 1, 2)
>>> positions
{0: '160', 1: '160', 2: '160'}
>>> positions[0]
'160'
>>> positions[2] = 160
>>> positions
{0: '160', 1: '160', 2: 160}
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
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,692 Oct-29-2023, 01:30 PM
Last Post: omemoe277
  Formatting outputs created with .join command klairel 2 593 Aug-23-2023, 08:52 AM
Last Post: perfringo
  I have written a program that outputs data based on GPS signal kalle 1 1,132 Jul-22-2022, 12:10 AM
Last Post: mcmxl22
  Why does absence of print command outputs quotes in function? Mark17 2 1,341 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Thoughts on interfacing with a QR code reader that outputs keystrokes? wrybread 1 1,448 Oct-08-2021, 03:44 PM
Last Post: bowlofred
  Combining outputs into a dataframe rybina 0 1,649 Mar-15-2021, 02:43 PM
Last Post: rybina
  Multi set string inputs/outputs kwmcgreal 2 2,008 Sep-26-2020, 10:44 PM
Last Post: kwmcgreal
  How to use subprocess to get multiple data outputs in desired folder? 3SG14 1 2,165 Sep-19-2020, 05:46 PM
Last Post: bowlofred
  Outputs missing SamAnw 4 2,537 Feb-12-2020, 04:32 PM
Last Post: adetheheat
  Interpreter and running a .py file give different outputs PythonNPC 5 2,946 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