Решение на doge от Димитър Чаушев

Обратно към всички решения

Към профила на Димитър Чаушев

Резултати

  • 10 точки от тестове
  • 1 отнета точка
  • 9 точки общо
  • 15 успешни тест(а)
  • 0 неуспешни тест(а)

Код

def wow_such_much(start, end):
doge_list = []
for number in range (start, end):
if number % 3 is 0 and number % 5 is not 0:
doge_list.append("such")
elif number % 5 is 0 and number % 3 is not 0:
doge_list.append("much")
elif number % 3 is 0 and number % 5 is 0:
doge_list.append("suchmuch")
elif number % 3 is not 0 and number % 5 is not 0:
doge_list.append(str(number))
return(doge_list)
def count_doge_words(input_string):
number_of_doge_words = 0
splitted_sentance = input_string.split()
doge_words = ["wow", "lol", "so", "such", "much", "very"]
for word in splitted_sentance:
if word in doge_words:
number_of_doge_words += 1
return number_of_doge_words

Лог от изпълнението

...............
----------------------------------------------------------------------
Ran 15 tests in 0.010s

OK

История (5 версии и 1 коментар)

Димитър обнови решението на 06.03.2014 22:10 (преди над 10 години)

+def wow_such_much(start, end):
+ a = []
+ for x in range (start, end):
+ if x % 3 is 0 and x % 5 is not 0:
+ a.append("such")
+ if x % 5 is 0 and x % 3 is not 0:
+ a.append("much")
+ if x% 3 is 0 and x % 5 is 0:
+ a.append("suchmuch")
+ if x % 3 is not 0 and x % 5 is not 0:
+ a.append(x)
+ print(a)
+
+
+def count_doge_words(str):
+ cnt = 0
+ a = ["wow", "lol", "so", "such", "much", "very"]
+ for x in a:
+ while x in str:
+ cnt += 1
+ str = str.replace(x, "", 1)
+
+ print(cnt)
  • В момента функциите ти в момента не връщат никакъв резултат, а просто изкарват неща по екрана
  • От имената, които си избрал за променливите си, не се разбира за какво ги ползваш. Опитай се да измислиш по-добри
  • За първата функция искаме и числата да са стрингове

Димитър обнови решението на 07.03.2014 13:59 (преди над 10 години)

def wow_such_much(start, end):
- a = []
- for x in range (start, end):
- if x % 3 is 0 and x % 5 is not 0:
- a.append("such")
- if x % 5 is 0 and x % 3 is not 0:
- a.append("much")
- if x% 3 is 0 and x % 5 is 0:
- a.append("suchmuch")
- if x % 3 is not 0 and x % 5 is not 0:
- a.append(x)
- print(a)
+ doge_list = []
+ for number in range (start, end):
+ if number % 3 is 0 and number % 5 is not 0:
+ doge_list.append("such")
+ elif number % 5 is 0 and number % 3 is not 0:
+ doge_list.append("much")
+ elif number % 3 is 0 and number % 5 is 0:
+ doge_list.append("suchmuch")
+ elif number % 3 is not 0 and number % 5 is not 0:
+ doge_list.append(str(number))
+ return(doge_list)
+
def count_doge_words(str):
- cnt = 0
- a = ["wow", "lol", "so", "such", "much", "very"]
- for x in a:
- while x in str:
- cnt += 1
- str = str.replace(x, "", 1)
+ number_of_doge_words = 0
+ doge_words = ["wow", "lol", "so", "such", "much", "very"]
+ for word in doge_words:
+ while word in str:
+ number_of_doge_words += 1
+ str = str.replace(word, "", 1)
- print(cnt)
+ return number_of_doge_words

Димитър обнови решението на 07.03.2014 19:46 (преди над 10 години)

def wow_such_much(start, end):
doge_list = []
+ if start <= 0:
+ end +=1
for number in range (start, end):
if number % 3 is 0 and number % 5 is not 0:
doge_list.append("such")
elif number % 5 is 0 and number % 3 is not 0:
doge_list.append("much")
elif number % 3 is 0 and number % 5 is 0:
doge_list.append("suchmuch")
elif number % 3 is not 0 and number % 5 is not 0:
doge_list.append(str(number))
return(doge_list)
def count_doge_words(str):
number_of_doge_words = 0
doge_words = ["wow", "lol", "so", "such", "much", "very"]
for word in doge_words:
while word in str:
number_of_doge_words += 1
str = str.replace(word, "", 1)
return number_of_doge_words

Димитър обнови решението на 10.03.2014 23:05 (преди над 10 години)

def wow_such_much(start, end):
doge_list = []
- if start <= 0:
- end +=1
for number in range (start, end):
if number % 3 is 0 and number % 5 is not 0:
doge_list.append("such")
elif number % 5 is 0 and number % 3 is not 0:
doge_list.append("much")
elif number % 3 is 0 and number % 5 is 0:
doge_list.append("suchmuch")
elif number % 3 is not 0 and number % 5 is not 0:
doge_list.append(str(number))
return(doge_list)
def count_doge_words(str):
number_of_doge_words = 0
+ splitted_sentance = str.split()
doge_words = ["wow", "lol", "so", "such", "much", "very"]
- for word in doge_words:
- while word in str:
+
+ for word in splitted_sentance:
+ if word in doge_words:
number_of_doge_words += 1
- str = str.replace(word, "", 1)
return number_of_doge_words

Димитър обнови решението на 10.03.2014 23:08 (преди над 10 години)

def wow_such_much(start, end):
doge_list = []
for number in range (start, end):
if number % 3 is 0 and number % 5 is not 0:
doge_list.append("such")
elif number % 5 is 0 and number % 3 is not 0:
doge_list.append("much")
elif number % 3 is 0 and number % 5 is 0:
doge_list.append("suchmuch")
elif number % 3 is not 0 and number % 5 is not 0:
doge_list.append(str(number))
return(doge_list)
-def count_doge_words(str):
+def count_doge_words(input_string):
number_of_doge_words = 0
- splitted_sentance = str.split()
+ splitted_sentance = input_string.split()
doge_words = ["wow", "lol", "so", "such", "much", "very"]
for word in splitted_sentance:
if word in doge_words:
number_of_doge_words += 1
return number_of_doge_words