By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,842 Members | 2,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,842 IT Pros & Developers. It's quick & easy.

What does the following code give us?

P: 5
What does the following code give us?
>>> b=(1)
Jan 2 '19 #1
Share this Question
Share on Google+
1 Reply


P: 9
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’>
Jan 3 '19 #2

Post your reply

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