Skip to content

Commit

Permalink
Functions Assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
alilawalmuazu committed Jan 7, 2024
1 parent 4483da8 commit 614236f
Show file tree
Hide file tree
Showing 41 changed files with 4,222 additions and 275 deletions.
1,089 changes: 1,089 additions & 0 deletions Python_crash_course_Assignments/Chapter_008_Functions/Functions.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "1cf93848",
"metadata": {},
"outputs": [],
"source": [
"import my\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "191ad533",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello\n"
]
}
],
"source": [
"my.greet(\"Aliyu\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3d1884d4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
3 changes: 3 additions & 0 deletions Python_crash_course_Assignments/Chapter_008_Functions/my.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def greet(name):
"""A simple function to greet the user."""
print("Hello")
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "05ee6a78",
"metadata": {},
"outputs": [],
"source": [
"#my_function.py\n",
"def print_message():\n",
" print(\"Hello World!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "d437ac76",
"metadata": {},
"outputs": [],
"source": [
"#my_function.py\n",
"def print_message():\n",
" print(\"Hello World!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
39 changes: 39 additions & 0 deletions Python_crash_course_Assignments/Chapter_008_Functions/my_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "fd01eba4",
"metadata": {},
"outputs": [],
"source": [
"# my_module.py\n",
"\n",
"def greet(sname):\n",
" \"\"\"A simple function to greet the user.\"\"\"\n",
" print(\"Hello\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# printing_functions.py

def print_models(unprinted_designs, completed_models):
"""Simulate printing each design until none are left."""
while unprinted_designs:
current_design = unprinted_designs.pop()
print(f"Printing model: {current_design}")
completed_models.append(current_design)

def show_completed_models(completed_models):
"""Show all the completed models."""
print("\nCompleted models:")
for model in completed_models:
print(model)
Binary file not shown.
Loading

0 comments on commit 614236f

Please sign in to comment.