Skip to content
Open
426 changes: 426 additions & 0 deletions your-code/.ipynb_checkpoints/check1_2-checkpoint.ipynb

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions your-code/.ipynb_checkpoints/day4 morning-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 34,
"id": "c2179e4a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['quick', 'brown', 'jumps', 'over', 'lazy']\n"
]
}
],
"source": [
"#my solution\n",
"\n",
"strin_ph= ['the quick brown fox jumps over the lazy dog']\n",
"new_str=[]\n",
"\n",
"split_str= strin_ph[0].split()\n",
"\n",
"#new=[split_str for split_str if len(word) >=4 new_str.append(word) ]\n",
"\n",
"\n",
"for word in split_str :\n",
" if len(word) >= 4:\n",
" new_str.append(word)\n",
" else:\n",
" continue\n",
" \n",
"print(new_str) \n",
"\n",
"\n",
"\n",
"lst=[5, 5, 3, 5, 4, 4, 3]\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "383aef1c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[5, 5, 3, 5, 4, 4, 3]\n"
]
}
],
"source": [
"#part 1 teacher solution\n",
"teste_st= ['the quick brown fox jumps over the lazy dog']\n",
"size=[]\n",
"split_to_list= teste_st[0].split(' ')\n",
"\n",
"for word in split_to_list:\n",
" if word.lower() != 'the':\n",
" lenght=len(word)\n",
" size.append(lenght)\n",
"print(size)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "6b0e728e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[5, 5, 3, 5, 4, 4, 3]\n"
]
}
],
"source": [
"#list comprehension\n",
"teste_st= ['the quick brown fox jumps over the lazy dog']\n",
"\n",
"test_list= teste_st[0].split(' ')\n",
"\n",
"size=[len(word) for word in test_list if word.lower() != 'the']\n",
"\n",
"print(size)"
]
},
{
"cell_type": "code",
"execution_count": 49,
"id": "4d835242",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"quick brown jumps over lazy\n"
]
}
],
"source": [
"#part 2\n",
"\n",
"lst=' '.join([word for word in test_list if len(word) >=4])\n",
"\n",
"print(lst)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53feac77",
"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.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading