commited all contents created by participants
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2017 Constant, Algolit
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details: <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
'''
|
||||
Input texts are checked against a dictionary that assigns weights to different vowels.
|
||||
The script gives a score for a specific sentence.
|
||||
'''
|
||||
|
||||
# create a dictionary
|
||||
scrabble = {'au': 'o', 'ie': 'y', 'eau': 'o', 'ai': 'e'}
|
||||
|
||||
# find a sentence / string
|
||||
sentence = "J'ai la vie qui est un beau mystère qu'il faut vivre, et non un problème à résoudre."
|
||||
|
||||
# split sentence in list of words
|
||||
words = sentence.split()
|
||||
|
||||
# for each word
|
||||
for word in words:
|
||||
# iterate over dictionary
|
||||
for k in scrabble:
|
||||
if k in word:
|
||||
word = word.replace(k,scrabble[k])
|
||||
print(word)
|
||||
Reference in New Issue
Block a user