Add Variables to Tuple

+1 vote

I want to add the following as a tuple. What should  I do?

name = "tom"
   age = 4
   location = "paris"
Jul 4 in Python by Nisa
• 1,090 points

edited Jul 5 by Kalgi 15 views

1 answer to this question.

0 votes

Use the following piece of code:

   name = "tom"
   age = 4
   location = "paris"
   tom = tuple((name, age, location))
tom

OUTPUT:

('tom', 4, 'paris')
answered Jul 4 by Wajiha
• 1,920 points

edited Jul 5 by Kalgi

Related Questions In Python

0 votes
1 answer

How to add a new line in Python?

You can use '\n' for a next ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
126 views
0 votes
1 answer

How to add to the python path in Windows?

You know what has worked for me ...READ MORE

answered Jul 25, 2018 in Python by Frankie
• 9,810 points
129 views
0 votes
1 answer

Add new keys to a dictionary?

>>> d = {'key':'value'} >>> print(d) {'key': ...READ MORE

answered Aug 13, 2018 in Python by Priyaj
• 56,940 points
34 views
0 votes
1 answer

How to add python console in spyder

(Spyder developer here) The Python console was ...READ MORE

answered Sep 18, 2018 in Python by Priyaj
• 56,940 points
1,304 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 348 views
+4 votes
6 answers
0 votes
1 answer

How to check if a website allows web scraping?

To check if a website allows web ...READ MORE

answered Jun 14 in Python by Wajiha
• 1,920 points
417 views