I had a mental breakdown
This commit is contained in:
106
09_gyak.ipynb
106
09_gyak.ipynb
@ -43,6 +43,112 @@
|
||||
"\n",
|
||||
"print([list(map(sum,i)) for i in lines])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"A leghosszab szó: 'gépidőelszámolást', ami 17 karakterből áll\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"lines = []\n",
|
||||
"with open(\"igazi.txt\") as f:\n",
|
||||
" lines.extend(f.readlines())\n",
|
||||
"lines = list(set([i.strip() for i in lines]))\n",
|
||||
"lenoflines = [len(i) for i in lines]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"print(f\"A leghosszab szó: '{lines[lenoflines.index(max(lenoflines))]}', ami {max(lenoflines)} karakterből áll\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"65 90\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(ord('A'), ord('Z'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 55,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Blackburn Rovers 45\n",
|
||||
"Wolverhampton Wanderers 38\n",
|
||||
"Fulham FC 55\n",
|
||||
"Aston Villa 39\n",
|
||||
"Liverpool FC 43\n",
|
||||
"Sunderland AFC 45\n",
|
||||
"Queens Park Rangers 43\n",
|
||||
"Bolton Wanderers 42\n",
|
||||
"Wigan Athletic 41\n",
|
||||
"Norwich City 47\n",
|
||||
"Newcastle United 48\n",
|
||||
"Arsenal FC 58\n",
|
||||
"Stoke City 44\n",
|
||||
"Chelsea FC 60\n",
|
||||
"West Bromwich Albion 40\n",
|
||||
"Manchester United 71\n",
|
||||
"Manchester City 74\n",
|
||||
"Swansea City 46\n",
|
||||
"Tottenham Hotspur 58\n",
|
||||
"Everton FC 47\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"class matches:\n",
|
||||
" def __init__(self):\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"A = []\n",
|
||||
"with open(\"pl.txt\") as f:\n",
|
||||
" for _ in range(6):\n",
|
||||
" next(f)\n",
|
||||
" for i in f.readlines():\n",
|
||||
" match = matches()\n",
|
||||
" line = i.strip().split('\\t')\n",
|
||||
" match.ford = line[0]\n",
|
||||
" match.hteam = line[1]\n",
|
||||
" match.vteam = line[2]\n",
|
||||
" match.hgoal = int(line[3])\n",
|
||||
" match.vgoal = int(line[4])\n",
|
||||
" A.append(match)\n",
|
||||
"\n",
|
||||
"teams = {}\n",
|
||||
"for i in A:\n",
|
||||
" if i.hteam in teams.keys():\n",
|
||||
" teams[i.hteam] += i.hgoal\n",
|
||||
" else:\n",
|
||||
" teams.update({i.hteam : i.hgoal})\n",
|
||||
" if i.vteam in teams.keys():\n",
|
||||
" teams[i.vteam] += 1 \n",
|
||||
" else:\n",
|
||||
" teams.update({i.vteam : 1})\n",
|
||||
"\n",
|
||||
"print(\"\\n\".join(f\"{i.ljust(25)} {j}\" for i, j in teams.items()))"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
Reference in New Issue
Block a user