Write a program that takes a **string** as input and outputs “Binary Number” if the string contains only 0s or 1s. Otherwise, outputs “Not a Binary Number”. ===================================================================== **Sample Input 1:**\ 01101101101 **Sample Output 1:**\ Binary Number ===================================================================== **Sample Input 2:**\ 12344ab0 **Sample Output 2:**\ Not a Binary Number ===================================================================== **Sample Input 3:**\ 10127490111 **Sample Output 3:**\ Not a Binary Number ===================================================================== **Sample Input 4:**\ Binary Number **Sample Output 4:**\ Not a Binary Number #todo #assign the result string to variable "out_str" def task3(in_str): # YOUR CODE HERE return out_str
Write a
=====================================================================
**Sample Input 1:**\
01101101101
**Sample Output 1:**\
Binary Number
=====================================================================
**Sample Input 2:**\
12344ab0
**Sample Output 2:**\
Not a Binary Number
=====================================================================
**Sample Input 3:**\
10127490111
**Sample Output 3:**\
Not a Binary Number
=====================================================================
**Sample Input 4:**\
Binary Number
**Sample Output 4:**\
Not a Binary Number
#todo
#assign the result string to variable "out_str"
def task3(in_str):
# YOUR CODE HERE
return out_str
Step by step
Solved in 4 steps with 3 images