Challenge 3: Convert Decimal Number to Binary Number
Given a decimal number convert it to a binary number.
We'll cover the following
Problem Statement
Write a function that takes a number testVariable
and returns a string that is its equivalent binary number.
Input
A variable testVariable
containing the decimal number.
Output
String variable that contains the equivalent binary number of the input number.
Sample Input
11
Sample Output
"1011"
Try it Yourself
Try to attempt this challenge by yourself before moving on to the solution. Good luck!
def decimalToBinary(testVariable) :# Write your code herereturn None
Let’s have a look at the solution review of this problem.