Skip to content

Instantly share code, notes, and snippets.

@huseyinyilmaz
Created December 13, 2017 01:44
Show Gist options
  • Save huseyinyilmaz/87a54ca7335faa620d29b10399ddb07d to your computer and use it in GitHub Desktop.
Save huseyinyilmaz/87a54ca7335faa620d29b10399ddb07d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"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