This forum is now read-only. Please use our new forums! Go to forums
banner
Close banner
Feel good about counting in base 2 at this point, but curious what the 0b confers when binaries are written out.
Answer 515dba9b7a0db49b5800026e
1
vote
That is used to express the value is a binary literal. You can use 0b or 0B. That means you could write something like this:
four = 0b100print four
And get 4 in the console
points
Submitted by
over 11 years
Answer 525faf41abf821bdd7001d4a
1
vote
‘0b’ is used to tell the computer that the number you typed is a base-2 number not a base-10 number.
Popular free courses
Free Course
Learn SQL
Beginner friendly,
4 Lessons
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
Language Fluency
Free Course
Learn JavaScript
Beginner friendly,
11 Lessons
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
Language Fluency
Free Course
Learn HTML
Beginner friendly,
6 Lessons
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
Language Fluency