Question: pls complet the answer Q4. Complete the missing statements in the following program #Program reads a word and scrambles its letters #scrambles a word by

pls complet the answer
pls complet the answer Q4. Complete the missing statements in the following
program \#Program reads a word and scrambles its letters \#scrambles a word

Q4. Complete the missing statements in the following program \#Program reads a word and scrambles its letters \#scrambles a word by swapping two letters other than first and last \# eparam word a string * greturn the scrambled word as a string def scramble (word): if len (word) [0] \#new string to contain the scrambled word Agenerate two indexes r1 and 2 between 1 and len (word) 2 whose boharacters are distinet the algorithm given at the end of Week 10 lecture2 s1ides Program convert from Roman numerals to a decimal number. Complete the missing code def main(): print(romantodecimal ("I")) 11 print (romanTobecimal ("VII")) $7 print (romantobecimal ("MCMLXXVIII")) | 1978 print (ronanToDecimal ("MMMCMXCIX")) 13999 Hcomputes the decimal value of a roman number eparam I the roman number string. - ereturn the decimal value of the roman number string def romanTobecimal (x) : total = 0 tto store the equivalent decimal value while r in "n : Bloop until no more letters in the roman number string return total 11. Convert a single Roman numeral character to decimal. eparam I the character to convert exeturn the decimal equivalent of x def convertDigit (r): if r=I : return 1 if r= "V" : return 5 lif x=x " : return 10 if xexLLs : return 50 if I wa "C" : return 100 if r= return 100 return 500 if x= a return 1000 return "" - Cal1 the main function. main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!