3

In Python, is there a way to make

a, b, c, d, e = 'dog'

so that

a = 'dog'

b = 'dog'

#etc.

or

a, b, c, d, e = list()

so that

type(a through e) 

returns

type 'list'
3
  • 1
    Which programming language? Commented Feb 3, 2015 at 21:18
  • a = b = c = d = e = 'dog' in all C successors, including C++, Java, C#, PHP and other. Commented Feb 3, 2015 at 21:21
  • @mopo922 Python! sorry! Commented Feb 3, 2015 at 21:26

2 Answers 2

4

This has already been answered here: Set multiple variables to the same value in Javascript

in python it would be:

a = b = c = d = e = 'dog'

its the same in javascript but with 'var' at the beginning:

var a = b = c = d = e = 'dog'
Sign up to request clarification or add additional context in comments.

Comments

1

In c# in would be as simple as declaring the variables and then setting them all equal.

string a,b,c,d;

a = b = c = d = "dog";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.