teleren/devto huggingface dataset:
Calling All Developers! Contribute to golly: Empower the Go Community Together 🚀
Tags: devops, opensource, go, discuss
Published: 2024-07-16 15:20:09

**Introduction:**

Hey there, Dev.to community! Are you passionate about Go programming and looking for a meaningful open-source project to contribute to? Look no further! We're excited to introduce you to golly, an open-source Go library that's making waves in the Go community.

**About golly:**

- It is always a pain to maintain multiple third-party dependencies while building a project. We have come up with a solution where you just import 1 library and it should solve all your requirements to build your project.
- golly provides an extensive library from logger to messaging systems. You name it, we have it.
- You don't have to install any other dependeny as golly will take care of all your development needs while creating your go projects.

**Why Contribute?**

Benefits of contributing to golly:
- Enhance your Go programming skills.
- Collaborate with a diverse and welcoming community.
- Build a strong open-source portfolio.
- Contribute to the Go ecosystem.

**How to Get Started:**

Project Link: [golly](https://github.com/nandlabs/golly)
We welcome any kind of contribution to the project as long as they uplift the project.
Contribution Guidelines: [Contribution Guidelines](https://github.com/nandlabs/golly/blob/main/CONTRIBUTING.md)
You can also get to know more about the project [here](https://github.com/nandlabs/golly/blob/main/README.md).

**Community and Communication:**

Please [raise an issue](https://github.com/nandlabs/golly/issues) with a label "question" if you have any doubts or questions, we are happy to help.
Please follow the [Code of Conduct](https://github.com/nandlabs/golly?tab=coc-ov-file) within the community.

Join us in the journey of building and improving golly! Whether you're an experienced Go developer or just getting started, there's a place for you in our vibrant and growing community. Let's make a difference together!

**Important Links**

Project: https://github.com/nandlabs/golly
Readme: https://github.com/nandlabs/golly/blob/main/README.md
Current Issues List: https://github.com/nandlabs/golly/issues
Welcome Thread - v285
Tags: welcome
Published: 2024-07-17 00:00:00

---
published_at : 2024-07-17 00:00 +0000
---
![Man waving hello and giving a thumbs up through a window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcetebm7nx1jbgbnuvw6.gif)
---

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

3. Come back next week to greet our new members so you can one day earn our [Warm Welcome Badge](https://dev.to/community-badges?badge=warm-welcome)!
Configuring Spring Boot Application with AWS Secrets Manager
Tags: article, blog
Published: 2024-07-08 11:46:08

---
title: Configuring Spring Boot Application with AWS Secrets Manager
published: true
date: 2024-05-08 15:17:29 UTC
tags: article, Blog
canonical_url: https://deniskisina.dev/configuring-spring-boot-application-with-aws-secrets-manager/
---

In modern application development, securely managing and storing sensitive data, such as private keys, service account numbers, and environment-specific configurations, is crucial. Recently, we faced a challenge where we needed to move our Spring Boot application’s secrets and configuration data from GitLab’s deployment platform storage and Docker System Environment variables to AWS Secrets Manager.

Initially, our application was connecting to the PostgreSQL database using properties passed through the pipeline environment. However, to integrate with AWS Secrets Manager, we needed to restructure and refactor the application’s flow.

**Understanding Java APIs for Environment Configuration**

Java provides several APIs to interact with the application’s environment, including retrieving and setting environment variables. One such API is `System.getenv()`, which returns a `Map<String, String>` containing the current system environment variables.

Here’s an example of how to iterate over the environment variables using `System.getenv()`:

Map<string string> env = System.getenv();</string>

for (Map.Entry<string string> entry : env.entrySet()) {<br>
    System.out.println(entry.getKey() + “=” + entry.getValue());<br>
}</string>

This code snippet will print out all the environment variables and their corresponding values.

**Integrating AWS Secrets Manager with Spring Boot**

To integrate AWS Secrets Manager with our Spring Boot application, we used the `aws-java-sdk-secretsmanager` library provided by AWS. This library allows us to retrieve secrets from AWS Secrets Manager and use them in our application.

Here’s an example of how to retrieve a secret from AWS Secrets Manager using the `aws-java-sdk-secretsmanager` library:

In this example, we first create an instance of `SecretsManagerClient` and then use the `getSecretValue` method to retrieve the secret value from AWS Secrets Manager. The `secretId` parameter is the ARN (Amazon Resource Name) of the secret you want to retrieve.

Once we have the secret value, we can use it in our application, such as setting environment variables or configuring database connections.

**Conclusion**

By integrating AWS Secrets Manager with our Spring Boot application, we can securely store and retrieve sensitive data, such as database credentials and API keys. This approach improves the security and maintainability of our application, as we no longer need to store sensitive data in version control systems or Docker environment variables.
Phalcon v5.7.0 Released
Tags: phalcon, phalcon5, release
Published: 2024-07-10 13:08:10

---
title: Phalcon v5.7.0 Released
published: true
date: 2024-05-17 00:01:02 UTC
tags: phalcon,phalcon5,release
canonical_url: 
---

We are happy to announce that Phalcon v5.7.0 has been released!

This release fixes a new setting for php.in, some changes and fixes to bugs.

A huge thanks to our community for helping out with bug fixing and more importantly bug reporting!

## Changelog

### Changed

- Changed `Phalcon\Support\HelperFactory` to use the internal mapper for better memory management [#16571](https://github.com/phalcon/cphalcon/issues/16571)

### Added

- New ini setting `phalcon.form.strict_entity_property_check` for `Phalcon\Forms\Form` to enable strict entity property checking. [#16567](https://github.com/phalcon/cphalcon/issues/16567)

### Fixed

- Fixed `Phalcon\Mvc\Cli\Router` to extend the `Phalcon\Mvc\Cli\RouterInterface` [#16551](https://github.com/phalcon/cphalcon/issues/16551)
- Fixed `Phalcon\Filter\Validation\Validator\StringLength::validate()` to correctly use the `include` parameter [#16560](https://github.com/phalcon/cphalcon/issues/16560)
- Fixed `Phalcon\Db\Column::TYPE_BINARY` and `Phalcon\Db\Column::TYPE_TINYINTEGER` to have unique values [#16532](https://github.com/phalcon/cphalcon/issues/16532)
- Fixed `Phalcon\Forms\Form` to bind only existing properties on entities, based on `phalcon.form.strict_entity_property_check` setting. [#16567](https://github.com/phalcon/cphalcon/issues/16567)
- Fixed `Phalcon\Filter\Sanitize\BoolVal` to correctly handle integers. [#16582](https://github.com/phalcon/cphalcon/issues/16582)

## Upgrade

Developers can upgrade using PECL

```
pecl install phalcon-5.7.0

```

To compile from source, follow our [installation document](https://docs.phalcon.io/5.7/installation)
Ibuprofeno.py💊| #140: Explica este código Python
Tags: python, spanish, learning, beginners
Published: 2024-07-13 11:00:00

## **<center>Explica este código Python</center>**
#### <center>**Dificultad:** <mark>Fácil</mark></center>

```py
def f(a,b):
    """
    f suma dos numeros pasados por parametro
    a -> int
    b -> int
    """
    return a + b
    
print(help(f))
```

* **A.** `None`
* **B.** `SyntaxError`
* **C.** `0`
* **D.** 
```py
    f suma dos numeros pasados por parametro
    a -> int
    b -> int
```

---

{% details **Respuesta:** %} 

* **D.** 
```py
    f suma dos numeros pasados por parametro
    a -> int
    b -> int
```

En Python podemos documentar una función haciendo uso del comentario con triple comilla (dentro de la función per ser) y posteriormente llamando a la función `help()` con el nombre de la función.

De esta manera veremos toda la documentación de la función por consola.

La función `help()` no solo sirve para funciones propias, sino que también puede usarse con cualquier función pre definida de Python. 



 
{% enddetails %}
Voluntarii proiectului peviitor.ro folosesc GitHub Desktop
Tags: peviitor, github, git
Published: 2024-07-15 13:50:41

Proiectul [peviitor.ro](https://peviitor.ro/) este un proiect de tipul OPEN SOURCE pe care fiecare voluntar îl poate edita. 
Noi, voluntarii ASOCIATIEI OPORTUNITATI SI CARIERE, folosim GitHub Desktop pentru a clona și a face push pentru toate repository-urile la care lucrăm.

---

[GitHub Desktop](https://desktop.github.com/)
Poți folosi acest tool pentru că este gratuit și te ajută să lucrezi cu Git fără să știi comenzile Git. 

---

În plus, are și integrare cu VSCode care funcționează atât pe Windows, cât și pe Linux cu versiunea sa, Code-OSS.

---
EcoDea Beauty E-commerce Store
Tags: devchallenge, wixstudiochallenge, webdev, javascript
Published: 2024-07-14 17:24:23


*This is a submission for the [Wix Studio Challenge ](https://dev.to/challenges/wix).*

## What I Built
<!-- Share an overview of your project. -->

[**EcoDea Beauty**](https://okolosarah402.wixstudio.io/ecodea-beauty/) is a modern and innovative e-commerce store that sells eco-friendly skincare and beauty products.

![EcoDea home page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ztt64p3ly89bl1u8bdd.jpg)

## Demo
<!-- Share a link to your Wix Studio app and include some screenshots here. -->
On the [**EcoDea Beauty**](https://okolosarah402.wixstudio.io/ecodea-beauty/) store, customers can do the following:

### Browse skincare products
Customers can browse their favorite skincare products and add them to cart.

![EcoDea products page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xk1j5n6amg3w7mborewa.gif)

![EcoDea cart page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39jwcpiwt1kfykma8tnj.png)


### Converse with the store's AI assistant

The store provides customers with a personal assistant called **Eda**🌿. This unique feature leverages the functionality of **conversational AI** to provide personalized assistance to customers searching for the perfect skincare product.

![ecodea chatbot interface](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jqovrlanavnre7hj927h.png)


### Request for products
Customers can request for products.

> Stay ahead of your competitors by listening to your customers. Get to know what your customers want with **Product Requests**.

This innovative feature enables customers to request products they need but are not available. This gives the store owner ideas on what products their customers want to see on their store page.

- First, the customer gets prompted to make a request after more than 60 seconds on the products page.
![Product request prompt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2c5sd3jofplsi5jkd6bf.png)


- Next, on the product request page, the customer can request a particular product
![product request page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymujvx08mlfsjqz36xwa.png)


- When the **Make Request** button is clicked, a form pops up for the customer to fill in and submit the details of their request
![product request form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60mcy1xg89clgjbthcxe.png)

- After the request is submitted, users can view their request and its status


![product request page with requests](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lstsx9ejib7ei7zoyebu.png)


**PS:** Mobile view is a little skewed, didn't have enough time to optimize the site for views other than desktop (started the project late).
Streamline MySQL Deployment with Docker and DbVisualizer
Tags: docker, mysql
Published: 2024-07-15 07:00:00

This guide demonstrates how to containerize a MySQL database using Docker and manage it using DbVisualizer for seamless deployment across various environments.

**Start by writing a Dockerfile.**

```
FROM mysql:latest
ENV MYSQL_ROOT_PASSWORD=password
COPY my-database.sql /docker-entrypoint-initdb.d/
```

**Build your Docker image.**

```bash
docker build -t my-database .
```

**Run your container.**

```bash
docker run -p 3306:3306 --name my-database-container -d my-database
```

In [DbVisualizer](https://www.dbvis.com/download/), create a new connection using the appropriate MySQL settings.

### FAQ

**What is Docker, and why should I containerize my database?**
Docker standardizes the deployment environment, ensuring your database runs the same everywhere.

**How do I containerize a MySQL database with Docker?**
Write a Dockerfile with the necessary configurations, build the image, and run the container.

**How do I connect to a containerized MySQL database with DbVisualizer?**
Use DbVisualizer to set up a new connection with your MySQL database settings.

**What is Docker Compose, and how can I use it with MySQL?**
Docker Compose handles multiple containers. Define your services in a `docker-compose.yml` file and start them using `docker-compose up`.

### Conclusion
Containerizing MySQL with Docker and managing it via DbVisualizer simplifies the deployment process. For more details please read the article [Containerizing MySQL with Docker and DbVisualizer](https://www.dbvis.com/thetable/containerizing-mysql-with-docker-and-dbvisualizer/).
Good commit message V/S Bad commit message 🦾
Tags: github, git, commit, development
Published: 2024-07-16 10:43:22

#### When developers are pushing their code to VCS(Version Control System) such as Git. If you are working in any industry for production level code.

#### One should learn to write better commit message and make it a habit so that it is easy for co-developers to understand the code just by seeing the commit message.

---

> You can use git log command to check all the commit messages, I bet you will come to see “Yep… I have absolutely no idea what I meant by ‘Fix style’ 6 months ago.” that doesn’t make any sense, what is fixed, what is the issue. 🥴

---

**Structure of Git commit message**

**Condensed**
```
git commit -m <message>
```

**Detailed**
```
git commit -m <title> -m <description>
```

---

**Tips for writing commit message**

1. _Use first letter as capital and rest as lowercase **(title case)**._
2. _Use type of commit message e.g. bugfix, error, refactor, bump, config._
3. _Commit length of body must be 50 characters and description must be at 
   least 72 characters._
4. _Be specific, don’t use worked, developed, thought, rather be direct, 
   “fix”._

---

**The commit type can include the following:**

- feat – a new feature is introduced with the changes
- fix – a bug fix has occurred
- chore – changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies)
- refactor – refactored code that neither fixes a bug nor adds a feature
- docs – updates to documentation such as a the README or other markdown files
- style – changes that do not affect the meaning of the code, likely related to code formatting such as white-space, missing semi-colons, and so on
- test – including new or correcting previous tests
- perf – performance improvements
- ci – continuous integration related
- build – changes that affect the build system or external dependencies
- revert – reverts a previous commit
การนำเข้าข้อมูลจากไฟล์ CSV เข้ามาใน Posstgres : ทักษะเบื้องต้นของ Data Engineer
Tags: postgres, csv, dataengineering
Published: 2024-07-14 08:38:10

##บทนำ##
เคยไหม ขณะประชุมการขึ้นระบบ CRM ของฝ่ายขายจะต้องมีการนำรายชื่อลูกค้าของแต่ละคนมาใส่ในฐานข้อมูลพอถามว่าเก็บข้อมูลไว้ที่ไหนจะพบว่าบางคนเก็บใน excle, Google Sheet หรือบางคนจดลงในสมุดก็มีซึ่งพนักงานขายบางคนมีรายชื่อตั้งแต่ 100 ถึง 1,000 
ปัญหาต่อมาคือใครจะคีย์ข้อมูลเข้าระบบ ในห้องประชุมเงียบ ประธานในที่ประชุมสั่งการให้ IT เขียนโปรแกรมดึงข้อมูลลูกค้าเข้าฐานข้อมูล (ช้ำคือเราเป็น admin ต้องสวมมงเป็น programmer ซะแล้ว)
ถ้าเรารับทำเราก็จะกลายเป็น programer อีกตำแหน่ง(ในเงินเดือนเท่าเดิม) ต้องรองรับทั้ง Excel,Number(สำหรับ Mac) และ Google Sheet ไหนจะต้องให้เสร็จตาม timeline ของระบบ CRM ที่จะขึ้นอีก
หนึ่งในวิธีแก้ปัญหาที่ดีที่สุดให้กับคนที่ชอบโยนปัญหาให้เราคือ... โยนปัญหากลับ เราแจ้งให้กับทางที่ประชุมว่าพี่แปลงข้อมูลพี่เป็นไฟล์ CSV ได้ไหมเดี๋ยวผม  import เองเกิดคำถามไปทั้งห้องประชุม ไฟล์ CSV คืออะไร ? 

##CSV คืออะไรกันแน่? 🤔##
CSV ย่อมาจาก "Comma-Separated Values" หรือ "ค่าที่คั่นด้วยเครื่องหมายจุลภาค" ในภาษาไทย แต่อย่าเพิ่งกลัวกับชื่อที่ดูเป็นทางการนี้! ลองนึกภาพว่า CSV เป็นเหมือนตารางข้อมูลแบบง่ายๆ ที่แต่ละช่องถูกแบ่งด้วยเครื่องหมายจุลภาค (,)
```csv
ชื่อ,อายุ,อาชีพ
สมชาย,30,วิศวกร
สมหญิง,28,นักการตลาด
สมศรี,35,ครู
```
เนื่องจากเป็นรูปแบบ text file  สามารถอ่านได้ง่ายจึงสามารถ ใช้ text editor ในการป้อนข้อมูลที่จดไว้ในกระดาษมาใส่ในรูปแบบของ CSV ได้
>ข้อควรระวังเมื่อใช้ CSV 🚨
>1. ข้อมูลที่มีเครื่องหมายจุลภาค: เช่นตัวเลขจำนวนเงิน เช่น 1,000 ต้องระวังเป็นพิเศษ เพราะอาจทำให้ข้อมูลผิดพลาดได้
>2. การเข้ารหัสตัวอักษร: บางครั้งอาจมีปัญหากับภาษาที่ไม่ใช่ภาษาอังกฤษ
>3. ข้อจำกัดด้านความปลอดภัย: ไม่เหมาะสำหรับข้อมูลที่ต้องการความปลอดภัยสูง(เช่นรหัสผ่าน) เพราะไม่มีการเข้ารหัส

ซึ่งในโปรแกรมจำพวก Excel,Number(สำหรับ Mac) และ Google Sheet มีความสามารถในการ Save as หรือ Export ข้อมูลเป็นรูปแบบ CSV แทบทุกตัว 

##เมื่อได้ไฟล์ CSV  มาแล้วทำยังไงต่อ ##
เราสามารถนำข้อมูลจากไฟล์ CSV เข้าสุ่ฐานข้อมูลผ่านคำสั่ง
```sql
COPY your_table_name(column1, column2, ...)
FROM '/path/to/your/file.csv'
DELIMITER ','
CSV HEADER;
```
โดย 
- you_table_name: เป็นตารางที่ต้องการนำข้อมูลจากไฟล์ ไปเก็บ
- /path/to/your/file.csv: ตำแหน่งไฟล์ CSV ที่เก็บข้อมูล(ต้องระบุเป็น full path)
- คำสั่ง DELIMITER ',': เป็นการบอกให้ใช้เครื่องหมาย , ในการแบ่งข้อมูล
- คำสั่ง CSV HEADER : เป็นการบอกให้ดึงข้อมูลแบบ CSV โดยบอกให้รู้ว่าแถวแรกของไฟล์เป็นชื่อคอลัมน์ ไม่ใช่ข้อมูลจริง

>**ข้อควรรู้**
>การนำข้อมูลเข้านอกจากคำสั่งCOPY แล้วยังมี \COPY โดยความแตกต่างกันคือ COPY จะดำเนินการบน server  ในขณะที่  \COPY ดำเนินการบน client


##บทส่งท้าย##
การนำเข้าข้อมูลงฐานข้อมูลเห็นหน้าที่หนึ่งในฐานะ database administrator พึ่งกระทำไม่ใช่หน้าที่ในการเขียนโปรแกรมในการนำเข้าข้อมูล ตัว Postres มีเครื่องมือในการนำเข้าข้อมูลสู่ตารางฐานข้อมูล นำเข้าแล้วอย่าลืมตรวจสอบข้อมูลหลังนำเข้าด้วยล่ะ 
จริงแล้วการนำข้อมูลเข้า หรือส่งออกจากฐานข้อมูลถือเป็นทักษธหนึ่งที่ Data Engineer พึงมี
ขอให้มีความสุขกับ ใดๆ โลกล้วน Postgres ด้วยนะครับ
🧭 🇹 When to use the non-null assertion operator in TypeScript
Tags: typescript, coding, todayilearned
Published: 2024-07-17 16:11:12

Did you know that TypeScript has a [non-null assertion operator](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator)?

The non-null assertion operator (!) is used to assert that a value is neither null nor undefined. It tells TypeScript's type checker to ignore the possibility that the value is null or undefined, thus bypassing type checking for these values.

---

## When to use it

Use the non-null assertion operator when you are certain that a variable will be assigned a non-null value when you access it (for example, after a type guard).

In the example below, we use a non-null assertion operator (at `user.email!`) because we're certain that the value of the email property exists. Even though email is defined as an optional value in the User interface, we're checking for its existence with a type guard in the getEmail function, so we can be sure that it exists.

Feel free to [check this example in the TypeScript Playground](https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgKoGdrIN4ChnLAAmAXMiAK4C2ARtANz7lxURnphSgDmjBEVOMAA2AfnacejAL65cMCiARhgAexDJuEMAFFBIgBQVMUMhmgBKEhy4huOOYRgGAhMegA6AUOEXkUbQooDQByADkAegBBELkIiJBVFSRkMAALODBkABUATwAHCABlBC58rIB3VQphInIk1LSoVQrkOA1oZqgnZAqUAKpVADcIOvSURJAAWkphYTb0ExV1ZFVCqEzVKA9kJgCwII13be8RFxk5XAR1DmRjsxNkAF4cQlJkAEYAGmZWMhCosJgEgQj9TsIyAAiOBApAAAXBHmuVEh0kY1xAt3Bz002j0PiMJgs6JuqmEEA8wlU3AMAANzFAQuhkOCyAASbDg6S04mOZBAA) and play with it.

```typescript
interface User {
  id: number;
  name: string;
  email?: string;
}

function getEmail(user: User): string {
  if (!user.email) return 'N/A';

  return user.email!;
}

const user: User = { id: 1, name: 'Alice', email: "alice@email.com"};
const email = getEmail(user);
console.log(`User's email: ${email}`);
```

Notice in this example that TypeScript would not throw an error if we removed the non-null assertion operator. 

In TypeScript, while accessing optional properties like email without the non-null assertion operator is allowed, adding the non-null assertion operator can assert your understanding that the property is indeed present when accessed. This can be helpful for clarity and documentation, especially in large codebases or when working in teams. It also prevents TypeScript from warning you about potentially undefined values and allows you to treat the property as if it is always present, avoiding unnecessary runtime checks.

---

Hope this article has clarified the use of the intriguing non-null assertion operator in TypeScript!

Feel free to reach out if you have any questions! You can also find me on [Github](https://github.com/AudreyKj), [LinkedIn](https://www.linkedin.com/in/audreykadjar/), and [Instagram](https://www.instagram.com/audreykadjar/).
Ibuprofeno.py💊| #141: Explica este código Python
Tags: python, spanish, beginners, learning
Published: 2024-07-15 11:00:00

## **<center>Explica este código Python</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```py
lista = [6,7,8,9,10]

res_map = list(map(lambda x: (x**2)/2, lista))
print(res_map)
```

* **A.** `[3.0, 3.5, 4.0, 4.5, 5.0]`
* **B.** `[18.0, 24.5, 32.0, 40.5, 50.0]`
* **C.** `[36, 49, 64, 81, 100]`
* **D.** `Ninguno de los anteriores`

---

{% details **Respuesta:** %} 

👉 **B.** `[18.0, 24.5, 32.0, 40.5, 50.0]`

Python es un lenguaje de programación multi paradigma, nos permite usar funciones típicas de este paradigma como `map()`, `filter()` y `reduce()`.

`map()` permite ejecutar una función en cada item de un iterable, en nuestro ejemplo, aplicamos `(x**2)/2` a cada valor de la lista `lista`.

Para una sintaxis mas clara usamos una función `lambda`.



 
{% enddetails %}
Ibuprofeno.py💊| #142: Explica este código Python
Tags: python, spanish, learning, beginners
Published: 2024-07-16 11:00:00

## **<center>Explica este código Python</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```py
lista = [6,7,8,9,10]

res_filter = list(filter(lambda x: x > 8 ,lista))
print(res_filter)
```

* **A.** `[9, 10]`
* **B.** `[6, 7, 8, 9, 10]`
* **C.** `[1, 2, 3, 4, 5, 6, 7]`
* **D.** `[8, 9, 10]`

---

{% details **Respuesta:** %} 

👉 **A.** `[9, 10]`

`filter()` se encarga de hacer un filtrado de un iterable, en nuestro ejemplo aplicamos la condición `x > 8` a toda la lista `lista`, entonces regresamos una nueva lista que solo tenga los items que cumplan con la condición dada.



 
{% enddetails %}
Ibuprofeno.py💊| #143: Explica este código Python
Tags: spanish, learning, beginners, python
Published: 2024-07-17 11:00:00

## **<center>Explica este código Python</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```py
from functools import reduce

res_reduce = reduce(lambda x,y : x+y, range(0,5))
print(res_reduce)
```

* **A.** `11`
* **B.** `9`
* **C.** `10`
* **D.** `8`

---

{% details **Respuesta:** %} 

👉 **C.** `10`

Para usar `reduce()` en Python necesitamos importar la función desde la utilidad `functools`.

En nuestro caso usamos `reduce()` para sumar todos los items de un iterable de números enteros entre 0 y 4: `0 + 1 + 2 + 3 + 4`.



 
{% enddetails %}