Absolute value (module) of a number
Let's say you have a negative number and you want to get its absolute value. For this, you can use the
Also,
➡️ Using the math module
If you need more advanced mathematical functions, you can use
➡️ Using a lambda function
You can also use
Let's say you have a negative number and you want to get its absolute value. For this, you can use the
abs() function. The abs() function returns the absolute value of any number (positive, negative, and complex). Below is shown how to get a list of absolute values from a list that contains both negative and positive numbers. We use list comprehension.list1 = [-12, -45, -67, -89, 34, 67, -13]
print([abs(num) for num in list1])
[12, 45, 67, 89, 34, 67, 13]Also,
abs() can be applied to a floating-point number, and it will return the absolute value. See below:num = -23.12
print(abs(num))
23.12If you need more advanced mathematical functions, you can use
fabs() from the math module. This function always returns a float.import math
num = -23.12
absolute_value = math.fabs(num)
absolute_value
23.12You can also use
lambda to turn a negative number into its absolute value. The code below checks if x is less than zero (that is, if it's a negative value). If so, it returns -x, essentially removing the minus and making the number positive. If x is not negative (greater than or equal to 0), it returns x as it is.num = -23.12
absolute_value = (lambda x: -x if x < 0 else x)(num)
absolute_value
23.12
Please open Telegram to view this post
VIEW IN TELEGRAM
1❤3
✨ base64 | Python Standard Library ✨
📖 A Python standard library module for encoding binary data as ASCII text using Base16, Base32, Base64, and Base85 schemes.
🏷️ #Python
📖 A Python standard library module for encoding binary data as ASCII text using Base16, Base32, Base64, and Base85 schemes.
🏷️ #Python
✨ Quiz: Duck Typing in Python: Writing Flexible and Decoupled Code ✨
📖 Check your grasp of Python's duck typing. Recognize behavior-based interfaces, use protocols and special methods, and know alternatives. Try the quiz.
🏷️ #intermediate #python
📖 Check your grasp of Python's duck typing. Recognize behavior-based interfaces, use protocols and special methods, and know alternatives. Try the quiz.
🏷️ #intermediate #python
✨ Quiz: Automate Python Data Analysis With YData Profiling ✨
📖 Test your knowledge of YData Profiling, including report creation, customization, performance optimization, time series analysis, and comparisons.
🏷️ #intermediate #data-science #data-viz
📖 Test your knowledge of YData Profiling, including report creation, customization, performance optimization, time series analysis, and comparisons.
🏷️ #intermediate #data-science #data-viz
❤1
Forwarded from Machine Learning with Python
Over 20 free courses are now available on our channel for a very limited time.
https://t.iss.one/DataScienceC
https://t.iss.one/DataScienceC
Telegram
Udemy Coupons
ads: @HusseinSheikho
The first channel in Telegram that offers free
Udemy coupons
The first channel in Telegram that offers free
Udemy coupons
❤1
✨ bdb | Python Standard Library ✨
📖 A Python standard library module that provides a generic debugger framework for setting breakpoints, stepping through code, and managing trace events.
🏷️ #Python
📖 A Python standard library module that provides a generic debugger framework for setting breakpoints, stepping through code, and managing trace events.
🏷️ #Python
✨ Quiz: How to Use the OpenRouter API to Access Multiple AI Models via Python ✨
📖 Test your Python skills with OpenRouter: learn unified API access, model switching, provider routing, and fallback strategies.
🏷️ #intermediate #ai #api
📖 Test your Python skills with OpenRouter: learn unified API access, model switching, provider routing, and fallback strategies.
🏷️ #intermediate #ai #api
🚀 Master Data Science & Programming!
Unlock your potential with this curated list of Telegram channels. Whether you need books, datasets, interview prep, or project ideas, we have the perfect resource for you. Join the community today!
🔰 Machine Learning with Python
Learn Machine Learning with hands-on Python tutorials, real-world code examples, and clear explanations for researchers and developers.
https://t.iss.one/CodeProgrammer
🔖 Machine Learning
Machine learning insights, practical tutorials, and clear explanations for beginners and aspiring data scientists. Follow the channel for models, algorithms, coding guides, and real-world ML applications.
https://t.iss.one/DataScienceM
🧠 Code With Python
This channel delivers clear, practical content for developers, covering Python, Django, Data Structures, Algorithms, and DSA – perfect for learning, coding, and mastering key programming skills.
https://t.iss.one/DataScience4
🎯 PyData Careers | Quiz
Python Data Science jobs, interview tips, and career insights for aspiring professionals.
https://t.iss.one/DataScienceQ
💾 Kaggle Data Hub
Your go-to hub for Kaggle datasets – explore, analyze, and leverage data for Machine Learning and Data Science projects.
https://t.iss.one/datasets1
🧑🎓 Udemy Coupons | Courses
The first channel in Telegram that offers free Udemy coupons
https://t.iss.one/DataScienceC
😀 ML Research Hub
Advancing research in Machine Learning – practical insights, tools, and techniques for researchers.
https://t.iss.one/DataScienceT
💬 Data Science Chat
An active community group for discussing data challenges and networking with peers.
https://t.iss.one/DataScience9
🐍 Python Arab| بايثون عربي
The largest Arabic-speaking group for Python developers to share knowledge and help.
https://t.iss.one/PythonArab
🖊 Data Science Jupyter Notebooks
Explore the world of Data Science through Jupyter Notebooks—insights, tutorials, and tools to boost your data journey. Code, analyze, and visualize smarter with every post.
https://t.iss.one/DataScienceN
📺 Free Online Courses | Videos
Free online courses covering data science, machine learning, analytics, programming, and essential skills for learners.
https://t.iss.one/DataScienceV
📈 Data Analytics
Dive into the world of Data Analytics – uncover insights, explore trends, and master data-driven decision making.
https://t.iss.one/DataAnalyticsX
🎧 Learn Python Hub
Master Python with step-by-step courses – from basics to advanced projects and practical applications.
https://t.iss.one/Python53
⭐️ Research Papers
Professional Academic Writing & Simulation Services
https://t.iss.one/DataScienceY
━━━━━━━━━━━━━━━━━━
Admin: @HusseinSheikho
Unlock your potential with this curated list of Telegram channels. Whether you need books, datasets, interview prep, or project ideas, we have the perfect resource for you. Join the community today!
Learn Machine Learning with hands-on Python tutorials, real-world code examples, and clear explanations for researchers and developers.
https://t.iss.one/CodeProgrammer
Machine learning insights, practical tutorials, and clear explanations for beginners and aspiring data scientists. Follow the channel for models, algorithms, coding guides, and real-world ML applications.
https://t.iss.one/DataScienceM
This channel delivers clear, practical content for developers, covering Python, Django, Data Structures, Algorithms, and DSA – perfect for learning, coding, and mastering key programming skills.
https://t.iss.one/DataScience4
Python Data Science jobs, interview tips, and career insights for aspiring professionals.
https://t.iss.one/DataScienceQ
Your go-to hub for Kaggle datasets – explore, analyze, and leverage data for Machine Learning and Data Science projects.
https://t.iss.one/datasets1
The first channel in Telegram that offers free Udemy coupons
https://t.iss.one/DataScienceC
Advancing research in Machine Learning – practical insights, tools, and techniques for researchers.
https://t.iss.one/DataScienceT
An active community group for discussing data challenges and networking with peers.
https://t.iss.one/DataScience9
The largest Arabic-speaking group for Python developers to share knowledge and help.
https://t.iss.one/PythonArab
Explore the world of Data Science through Jupyter Notebooks—insights, tutorials, and tools to boost your data journey. Code, analyze, and visualize smarter with every post.
https://t.iss.one/DataScienceN
Free online courses covering data science, machine learning, analytics, programming, and essential skills for learners.
https://t.iss.one/DataScienceV
Dive into the world of Data Analytics – uncover insights, explore trends, and master data-driven decision making.
https://t.iss.one/DataAnalyticsX
Master Python with step-by-step courses – from basics to advanced projects and practical applications.
https://t.iss.one/Python53
Professional Academic Writing & Simulation Services
https://t.iss.one/DataScienceY
━━━━━━━━━━━━━━━━━━
Admin: @HusseinSheikho
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
✨ Python Gains frozendict and Other Python News for March 2026 ✨
📖 Catch up on the latest Python news: frozendict joins the built-ins, Django patches SQL injections, and AI SDKs race to add WebSocket transport.
🏷️ #community #news
📖 Catch up on the latest Python news: frozendict joins the built-ins, Django patches SQL injections, and AI SDKs race to add WebSocket transport.
🏷️ #community #news
This channels is for Programmers, Coders, Software Engineers.
0️⃣ Python
1️⃣ Data Science
2️⃣ Machine Learning
3️⃣ Data Visualization
4️⃣ Artificial Intelligence
5️⃣ Data Analysis
6️⃣ Statistics
7️⃣ Deep Learning
8️⃣ programming Languages
✅ https://t.iss.one/addlist/8_rRW2scgfRhOTc0
✅ https://t.iss.one/Codeprogrammer
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
✨ MLflow | AI Coding Tools ✨
📖 An open-source platform for managing the machine learning lifecycle, including experiment tracking, model packaging, registry management, and GenAI observability.
🏷️ #Python
📖 An open-source platform for managing the machine learning lifecycle, including experiment tracking, model packaging, registry management, and GenAI observability.
🏷️ #Python
✨ Quiz: Python Stacks, Queues, and Priority Queues in Practice ✨
📖 Test your knowledge of stacks, queues, deques, and priority queues with practical questions and Python coding exercises.
🏷️ #intermediate #algorithms #data-structures
📖 Test your knowledge of stacks, queues, deques, and priority queues with practical questions and Python coding exercises.
🏷️ #intermediate #algorithms #data-structures