scholar@sap interview questions shared by candidates
Write a program to add numbers present in a String , example : Gl123a45ssd908oo6r, so the program should give 123 + 45 + 908 + 6 = 1082 as the result. There were 2 more programming questions related to stacks and linkedlists and one question on probability followed by a logical puzzle question.
def findSum(str1): temp = "0" Sum = 0 for ch in str1: if (ch.isdigit()): temp += ch else: Sum += int(temp) temp = "0" return Sum + int(temp) str1 = "Gl123a45ssd908oo6r" print(findSum(str1))
import re result = re.sub("[A-z]"," ",input) res = result.split(" ") sum=0 for i in res: if not i == "": sum+=int(i) input = input()
str=input() temp=0 sum=0 for i in str: if(i.isdigit()): temp=(temp*10)+int(i) else: sum=sum+temp temp=0 print(sum)
1.Tell me about yourself? and after that 2.Diff between C and C++ 3.Diff between Multilevel inheritence and Multiple inheritance 4.One small puzzle 5.If there is a cricket world cup match to be scheduled and its time table to be prepared then write a data base tables for that using primary key and foreign key 6.Find the second largest element in an array