Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How can I convert undecimal digits(with 'X' included) to decimal digits using my code. def updecimal to_desimal (undecimal_stc): decimal = power = while undecimal str:
How can I convert undecimal digits(with 'X' included) to decimal digits using my code.
def updecimal to_desimal (undecimal_stc): decimal = power = while undecimal str: digit = int (undecimal str [1]) decimal += digit (11 od power) undecimal str = undecimal str [:1] power t=1 return decimal \# tests def test_undecimal_to_decimal (decimal, undecimal_str): decimal = undecimal_to_decimal (undecimal_str) correct = isinstance(decimal, int) and decimal = decimal if not correct: print (f" \{undecimal str\} should give \{decima1\} not \{decimal_\}.") assert correct Cel1 In[18], line 3, in test_undecinal, co decinfl(decinal, undecimal str) 2 def test undecimal to decimal (decima1, undecimal str): Valuefirror: invalid literal for int() with base 10: ' X Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started