shahvansh123
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
Python simple solution
def cons_vowel(s):
vowel = ['A','E','I','O','U']
counter = 0
for i in range(len(s)-1):
if s[i] in vowel:
if s[i] == s[i+1]:
counter += 1
return counter
Comment hidden because of low score. Click to expand.
0
of 0 vote
def string_add_sub(s):
a = s.split()
if len(a[1])-1 != len(a[0]):
return 0
for i in range(len(a[1])):
if a[1][i] == "+":
result = int(a[0][:i]) + int(a[0][i:])
if a[1][i] == "-":
result = int(a[0][:i]) - int(a[0][i:])
return result
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Simple Python Solution
- shahvansh123 October 28, 2017