👍4
Build a Backend REST API with Python Django - Beginner.pdf
1.9 MB
Build a Backend REST API with Python & Django - Beginner, 2023
👍4🥰4❤1
👍4❤1
Python Handwritten Notes
👇👇
https://www.linkedin.com/posts/sql-analysts_python-notes-activity-7142377962867261440-WPZU?utm_source=share&utm_medium=member_android
Save it for your future reference
Like for more ❤️
👇👇
https://www.linkedin.com/posts/sql-analysts_python-notes-activity-7142377962867261440-WPZU?utm_source=share&utm_medium=member_android
Save it for your future reference
Like for more ❤️
👍8❤4
🔅 Compress Images
from PIL import Image
# https://t.iss.one/pythondevelopersindia
in_img = 'input.png'
out_img = 'compressed.png'
# Open the image
with Image.open(in_img) as img:
# Save the compressed image
img.save(out_img, 'PNG', quality=80)
print(f"Image compressed successfully!")
👍20❤4😁1
New year Giveaway 🎁
Special Python Cheatsheet
👇👇
https://www.linkedin.com/posts/sql-analysts_python-pythonprogramming-pythoncoding-activity-7147666971420004352-rafS?utm_source=share&utm_medium=member_android
Special Python Cheatsheet
👇👇
https://www.linkedin.com/posts/sql-analysts_python-pythonprogramming-pythoncoding-activity-7147666971420004352-rafS?utm_source=share&utm_medium=member_android
👍5❤3
👍7❤4
Python Tip for the day:
Use the "enumerate" function to iterate over a sequence and get the index of each element.
Sometimes when you're iterating over a list or other sequence in Python, you need to keep track of the index of the current element. One way to do this is to use a counter variable and increment it on each iteration, but this can be tedious and error-prone.
A better way to get the index of each element is to use the built-in "enumerate" function. The "enumerate" function takes an iterable (such as a list or tuple) as its argument and returns a sequence of (index, value) tuples, where "index" is the index of the current element and "value" is the value of the current element. Here's an example:
The output of this code would be:
Use the "enumerate" function to iterate over a sequence and get the index of each element.
Sometimes when you're iterating over a list or other sequence in Python, you need to keep track of the index of the current element. One way to do this is to use a counter variable and increment it on each iteration, but this can be tedious and error-prone.
A better way to get the index of each element is to use the built-in "enumerate" function. The "enumerate" function takes an iterable (such as a list or tuple) as its argument and returns a sequence of (index, value) tuples, where "index" is the index of the current element and "value" is the value of the current element. Here's an example:
Iterate over a list of strings and print each string with its indexIn this example, we use the "enumerate" function to iterate over a list of strings. On each iteration, the "enumerate" function returns a tuple containing the index of the current string and the string itself. We use tuple unpacking to assign these values to the variables "i" and "s", and then print out the index and string on a separate line.
strings = ['apple', 'banana', 'cherry', 'date']
for i, s in enumerate(strings):
print(f"{i}: {s}")
The output of this code would be:
appleUsing the "enumerate" function can make your code more concise and easier to read, especially when you need to keep track of the index of each element in a sequence.
1: banana
2: cherry
3: date
👍31😁5❤4🥰2