Skip to content

Commit 16e0329

Browse files
committed
Merge branch 'code-image-generator' of github.com:realpython/materials into code-image-generator
2 parents 081744c + 39953b1 commit 16e0329

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1913
-32
lines changed

consuming-apis-python/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python & APIs: A Winning Combo for Reading Public Data
2+
3+
Here you can find code examples showing how to read from different public APIs. Check out the Real Python tutorial [Python & APIs: A Winning Combo for Reading Public Data](https://realpython.com/python-api/) for more information.

consuming-apis-python/covid.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

consuming-apis-python/github.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ def create_oauth_link():
3333
# website to input your credentials. Since you're doing this
3434
# programmatically, you need to get the `url` parameter and print it in
3535
# the console instead.
36-
url = response.url
37-
38-
return url
36+
return response.url
3937

4038

4139
# In this method you'll exchange the code you got from the GitHub API with

ipython-console/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Code Snippets and IPython Cheat Sheet
2+
3+
This folder contains code resources and an IPython magic command cheat sheet based on the content of the Real Python tutorial [Unlock IPython's Magical Toolbox for Your Coding Journey](https://realpython.com/ipython-interactive-python-shell/).

ipython-console/employee.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
first_name = "Han"
2+
last_name = "Solo"
3+
department = "Accounts"
4+
salary = 1000
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import IPython
2+
3+
first_name = "Han"
4+
last_name = "Solo"
5+
department = "Accounts"
6+
print(f"{first_name} {last_name}")
7+
8+
IPython.embed()
9+
10+
salary = 1000

ipython-console/increment.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def salary_increment(salary):
2+
"""Calculate the new salary after applying an increment.
3+
4+
Args:
5+
salary (int): The current salary.
6+
7+
Returns:
8+
str: A string indicating the new salary after increment.
9+
"""
10+
increment = salary / 10
11+
new_salary = increment + salary
12+
return f"Your New Salary is: {new_salary}"
136 KB
Binary file not shown.

prompt-engineering/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2023 Real Python
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

0 commit comments

Comments
 (0)