468,512 Members | 1,544 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

What does the following code give us?

What does the following code give us?
>>> b=(1)
Jan 2 '19 #1
1 1067
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.

Similar topics

11 posts views Thread by Sier | last post: by
3 posts views Thread by RobertTG | last post: by
16 posts views Thread by Mars | last post: by
1 post views Thread by locy | last post: by
maher5
1 post views Thread by maher5 | last post: by
3 posts views Thread by qianz99 | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.