Pregunta de entrevista de J.P. Morgan

1. 10 min Coding : Write a code for Capitalize ( Refer the in put and output ) sample input : getCodeType output: Code_Type i/p : getCodeStyle o/p: Code_Style i/p: getSWIFTCode o/p: SWIFT_Code

Respuestas de entrevistas

Anónimo

2 jul 2025

# input : getCodeType output: Code_Type i/p : getCodeStyle o/p: Code_Style i/p: getSWIFTCode o/p: SWIFT_Code def capatilize_word(word): # Remove 'get' prefix if word.startswith("get"): word = word[3:] pos=0 count=0 for i in range(len(word)-1): if word[i].isupper() and word[i+1].islower(): count+=1 pos=i-1 if count == 2: pos = i-1 mod_word = word[:pos+1]+"_"+word[pos+1:] return mod_word print(capatilize_word("getSWIFTCode"))

Anónimo

14 ago 2022

a="getCodeType" b="" for i in range(0,len(a)): if (i+1

10

Anónimo

14 ago 2022

Indentation issue fixed:: a="getCodeType" b="" for i in range(0,len(a)): if (i+1

9