Created
December 13, 2017 01:44
-
-
Save huseyinyilmaz/87a54ca7335faa620d29b10399ddb07d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['2a', 'c', '3e', 'g', '2k', '2l', 'n', '2r', 'ı']" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#örnek çıktı:2ac3eg2k2ln2rı girilen:karanlık geceler\n", | |
"\n", | |
"def cml(v):\n", | |
" hrf = []\n", | |
" v.lower()\n", | |
" for i in v:\n", | |
" if not i in hrf and i !=\" \":\n", | |
" hrf.append(i)\n", | |
" hrf.sort()\n", | |
" for z , a in enumerate(hrf):\n", | |
" if not v.count(a)==1:#ilk gönderilen veriden harfin adetini buluyorum\n", | |
" hrf[z]=str(v.count(a))+a # sıralı olmasını istedikleri için harfleri adetleriyle birleştirip ekliyorum\n", | |
" return hrf\n", | |
"cml('karanlık geceler')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'2ac3eg2k2ln2rı'" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#örnek çıktı:2ac3eg2k2ln2rı girilen:karanlık geceler\n", | |
"\n", | |
"def cml(v):\n", | |
" hrf = []\n", | |
" v.lower()\n", | |
" for i in v:\n", | |
" if not i in hrf and i !=\" \":\n", | |
" hrf.append(i)\n", | |
" hrf.sort()\n", | |
" for z , a in enumerate(hrf):\n", | |
" if not v.count(a)==1:#ilk gönderilen veriden harfin adetini buluyorum\n", | |
" hrf[z]=str(v.count(a))+a # sıralı olmasını istedikleri için harfleri adetleriyle birleştirip ekliyorum\n", | |
" return ''.join(hrf)\n", | |
"cml('karanlık geceler')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment