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, 2019 in Python by Nisa
• 1,090 points

edited Jul 5, 2019 by Kalgi 406 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, 2019 by Wajiha
• 1,960 points

edited Jul 5, 2019 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
1,265 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,830 points
1,026 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
• 58,020 points
545 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
• 58,020 points
4,871 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,071 views
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, 2019 in Python by Wajiha
• 1,960 points
16,235 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP