Forwarded from Udemy Free
Python Practice Tests: 210+ Questions Basics to Advanced
210+ Python questions: fundamentals, OOP, libraries & advanced concepts. Ace your interview & certification prep.β¦
π· Category: development
π Language: English (US)
π₯ Students: 6,036 students
βοΈ Rating: 4.5/5.0 (25 reviews)
πββοΈ Enrollments Left: 65
β³ Expires In: 0D:30H:30M
π° Price:$9.59 βΉ FREE
π Coupon:
β οΈ Watch 2 short ads to unlock your free access.
π By: https://xn--r1a.website/Udemy26
#Programming #Coding #Development #Tech #Python #DataScience
210+ Python questions: fundamentals, OOP, libraries & advanced concepts. Ace your interview & certification prep.β¦
π· Category: development
π Language: English (US)
π₯ Students: 6,036 students
βοΈ Rating: 4.5/5.0 (25 reviews)
πββοΈ Enrollments Left: 65
β³ Expires In: 0D:30H:30M
π° Price:
π Coupon:
MGM3Y2D100β οΈ Watch 2 short ads to unlock your free access.
π By: https://xn--r1a.website/Udemy26
#Programming #Coding #Development #Tech #Python #DataScience
β€3
How to check if a string is printable in Python π€―
>>> "123".isprintable()
True
>>> "abc".isprintable()
True
>>> "\t
".isprintable()
False
#Python #Programming #Coding #Tutorial #Tech #Dev
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
>>> "123".isprintable()
True
>>> "abc".isprintable()
True
>>> "\t
".isprintable()
False
# Python string method .isprintable()
>>> "123".isprintable()
True
>>> "abc".isprintable()
True
>>> "\t
".isprintable()
False
#Python #Programming #Coding #Tutorial #Tech #Dev
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€6
collections.ChainMap β a built-in Python class that combines multiple dictionaries or other mappings into a single, updatable view. π§
Instead of merging dictionaries and creating new data structures in memory, it links them by reference, allowing you to search and manage them as a single entity. π
#Python #Coding #DataStructures #Programming #Tech #DevTools
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Instead of merging dictionaries and creating new data structures in memory, it links them by reference, allowing you to search and manage them as a single entity. π
# Example usage of collections.ChainMap
from collections import ChainMap
dict1 = {'a': 1, 'b': 2}
dict2 = {'b': 3, 'c': 4}
combined = ChainMap(dict1, dict2)
print(combined['b']) # Output: 2
#Python #Coding #DataStructures #Programming #Tech #DevTools
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€3
Function
is designed for pretty-printed, formatted output in Python. π
It automatically formats complex data structures, such as nested lists, dictionaries, and tuples, by adding indentation and line breaks for improved readability. β¨
Features:
β’ Supports customization of the output width for convenient formatting.
β’ Includes depth and compact parameters to control the level of nesting and display compactness.
β’ Available through the standard pprint module in the Python library. π»
#Python #Programming #Code #Developer #Tech #Scripting
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
pprint()
pprint()
is designed for pretty-printed, formatted output in Python. π
It automatically formats complex data structures, such as nested lists, dictionaries, and tuples, by adding indentation and line breaks for improved readability. β¨
Features:
β’ Supports customization of the output width for convenient formatting.
β’ Includes depth and compact parameters to control the level of nesting and display compactness.
β’ Available through the standard pprint module in the Python library. π»
#Python #Programming #Code #Developer #Tech #Scripting
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€7π1
Python Tip π
In Python, you can unpack both a string and a list using the same code. β¨
#Python #Coding #Programming #Tips #Tech #Developer
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
In Python, you can unpack both a string and a list using the same code. β¨
# Example usage
text = "abc"
lst = [1, 2, 3]
# Unpacking works similarly for both
a, b, c = text
x, y, z = lst
#Python #Coding #Programming #Tips #Tech #Developer
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€7
Forwarded from Udemy Free
π New Free Course Alert!
Data Structures & Algorithms (Python): Practice Exams
Ace technical coding interviews with 200 questions on Big O, Graphs, Hash Maps, and Dynamic Programming.β¦
π Category: Development / Software Engineering
π― Level: Intermediate Level
π£ Language: English
π¨βπ Enrolled: 317 students
β Rating: 0/5.0
π΅ Price:$49.99 β FREE (100% OFF)
π Coupon:
β‘ Your free link unlocks automatically in a few seconds β no ad required.
π By: https://xn--r1a.website/Udemy26
#Programming #Coding #Development #Tech #Python #DataScience
Data Structures & Algorithms (Python): Practice Exams
Ace technical coding interviews with 200 questions on Big O, Graphs, Hash Maps, and Dynamic Programming.β¦
π Category: Development / Software Engineering
π― Level: Intermediate Level
π£ Language: English
π¨βπ Enrolled: 317 students
β Rating: 0/5.0
π΅ Price:
π Coupon:
BC7C61AF20F4AE188D90β‘ Your free link unlocks automatically in a few seconds β no ad required.
π By: https://xn--r1a.website/Udemy26
#Programming #Coding #Development #Tech #Python #DataScience
β€2
The tell() function in Python π
The tell() function returns the current position of the file pointer within the data stream. It is most often used when working with files. π
The function does not accept any arguments and returns an integer β the position in bytes from the beginning of the stream. π’
#Python #Programming #Coding #FileHandling #DevTips #Tech
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
The tell() function returns the current position of the file pointer within the data stream. It is most often used when working with files. π
The function does not accept any arguments and returns an integer β the position in bytes from the beginning of the stream. π’
with open("file.txt", "rb") as f:
print(f.tell())#Python #Programming #Coding #FileHandling #DevTips #Tech
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€4
Forwarded from Udemy Free
Hands On Python Data Science - Data Science Bootcamp
Master Python for Data Science with Real-World Applications: Dive Deep into Data Analysis, Machine Learning
π· Category: Development
π Language: English
π₯ Students: 31,524 students
βοΈ Rating: 4.3/5.0
π° Price:$14.99 βΉ FREE
π Coupon:
π Tap "Get Coupon" below β the code unlocks inside the app after a short rewarded ad.
π By: https://xn--r1a.website/Udemy26
#Programming #Coding #Development #Tech #Python #DataScience
Master Python for Data Science with Real-World Applications: Dive Deep into Data Analysis, Machine Learning
π· Category: Development
π Language: English
π₯ Students: 31,524 students
βοΈ Rating: 4.3/5.0
π° Price:
π Coupon:
β’β’β’β’β’β’β’β’β’β’ (tap below to reveal)π Tap "Get Coupon" below β the code unlocks inside the app after a short rewarded ad.
π By: https://xn--r1a.website/Udemy26
#Programming #Coding #Development #Tech #Python #DataScience
β€1
π° 15-Hour "Python for Data Science" Course
β‘οΈ Learn Python for Data Science
https://enghusseinsheikho.substack.com/p/15-hour-python-for-data-science-course?r=3hwnr8&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true
#Python #DataScience #Coding #Tech #Learning #FreeCourse
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β‘οΈ Learn Python for Data Science
https://enghusseinsheikho.substack.com/p/15-hour-python-for-data-science-course?r=3hwnr8&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true
#Python #DataScience #Coding #Tech #Learning #FreeCourse
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€2π2π2
image.jpg
1.7 MB
Python is the #1 language in AI. π
But you donβt need to learn all of it. (save this) π
#Python #AI #Programming #DataScience #MachineLearning #Tech
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
But you donβt need to learn all of it. (save this) π
#Python #AI #Programming #DataScience #MachineLearning #Tech
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€5
π asyncio.Queue.shutdown() β shutting down handlers without special markers
Starting with Python 3.13, the asyncio.Queue can be closed using shutdown(), without the need to use None or other special values.
After shutdown(), no new items are added, and existing items are processed. When the queue is empty, get() will raise asyncio.QueueShutDown.
For a forced shutdown, there is shutdown(immediate=True), which clears the queue but may disrupt the normal behavior of join().
#Python #Asyncio #Programming #DevTips #Coding #Tech
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Starting with Python 3.13, the asyncio.Queue can be closed using shutdown(), without the need to use None or other special values.
import asyncio
async def worker(queue):
while True:
try:
task = await queue.get()
except asyncio.QueueShutDown:
break
print(task)
queue.task_done()
async def main():
queue = asyncio.Queue()
task = asyncio.create_task(worker(queue))
await queue.put("task-1")
await queue.put("task-2")
queue.shutdown()
await queue.join()
await task
asyncio.run(main())
After shutdown(), no new items are added, and existing items are processed. When the queue is empty, get() will raise asyncio.QueueShutDown.
For a forced shutdown, there is shutdown(immediate=True), which clears the queue but may disrupt the normal behavior of join().
#Python #Asyncio #Programming #DevTips #Coding #Tech
β¨ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
βοΈ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
β€1
Hallucinations in language models lead to the generation of false, yet convincingly sounding, facts.
Calculating the perplexity of the generated text allows us to assess the model's confidence in its responses.
We will write a Python script to calculate perplexity and filter out questionable generations.
Let's install the
transformers
and
torch
libraries to work with language models and calculate perplexity.
pip install transformers torch
The libraries for calculating perplexity have been successfully installed.
Let's create a Python script called
perplexity_check.py
that calculates the perplexity level for a given text.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "gpt2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
inputs = tokenizer("Example text for perplexity check.", return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs, labels=inputs["input_ids"])
print("Loss value:", outputs.loss.item())
The perplexity calculation script has been successfully created and is ready to run. π
# Verify the script's functionality
python3 -c "import torch; print('PyTorch Ready')"
Expected output:
PyTorch Ready
# cleanup (remove the test script)
rm -f perplexity_check.py
An abnormally high perplexity often indicates that the model has started "hallucinating" and generating illogical text.
Integrate this threshold into safety filters (Guardrails) to automatically block incorrect responses. π‘οΈ
https://xn--r1a.website/pythonRe
#Python #AI #LLM #MachineLearning #Coding #Tech
https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Learn Python Coding
Learn Python through simple, practical examples and real coding ideas. Clear explanations, useful snippets, and hands-on learning for anyone starting or improving their programming skills.
Admin: @HusseinSheikho || @Hussein_Sheikho
Admin: @HusseinSheikho || @Hussein_Sheikho
β€5