424,054 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,054 IT Pros & Developers. It's quick & easy.

What does the following code give us?

P: 4
What does the following code give us?
>>> b=(1)
2 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


P: 4
Not a tuple. This gives us a plain integer.

>>> type(b)
<class ‘int’>
To let it be a tuple, we can declare so explicitly with a comma after 1:

>>> b=(1,)
>>> type(b)
<class ‘tuple’>
2 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.