Python Forum
Create new variable dependent on two existing variables
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create new variable dependent on two existing variables
#6
why do you need such function in a first place

spam = 2
eggs = 3
foo = 2

bar = spam == eggs
print(bar)

bar = spam == foo
print(bar)
Output:
False True
Note, these are bool values True and False, not strings "True" and "False"

and of course you can always can do, just

if spam == eggs:
    # do samething
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Create new variable dependent on two existing variables - by buran - Oct-25-2020, 07:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create X Number of Variables and Assign Data RockBlok 8 1,018 Nov-14-2023, 08:46 AM
Last Post: perfringo
  How to create a variable only for use inside the scope of a while loop? Radical 10 1,874 Nov-07-2023, 09:49 AM
Last Post: buran
  Modify an Energy Model to account for year dependent interest rate rather than only t giovanniandrean 0 442 Oct-10-2023, 07:00 AM
Last Post: giovanniandrean
Question How create programmatically variables ? SpongeB0B 6 1,377 Aug-19-2023, 05:10 AM
Last Post: SpongeB0B
  loop (create variable where name is dependent on another variable) brianhclo 1 1,170 Aug-05-2022, 07:46 AM
Last Post: bowlofred
  Create array of values from 2 variables paulo79 1 1,118 Apr-19-2022, 08:28 PM
Last Post: deanhystad
  How to create 2 dimensional variables in Python? plumberpy 5 1,907 Mar-31-2022, 03:15 AM
Last Post: plumberpy
  how to easily create a list of already existing item CompleteNewb 15 3,654 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb
  is it pythonic to add a name 'attribute' to an existing variable? amjass12 6 2,248 Oct-04-2021, 09:33 PM
Last Post: amjass12
Question Calling on a Variable using other Variables jacknewport 4 2,036 Jul-23-2021, 04:18 PM
Last Post: jacknewport

Forum Jump:

User Panel Messages

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