Telegram Group & Telegram Channel
اجرای یک تابع بر روی تمام عناصر یک لیست با تابع map

یکی از توابع زیبای پایتون تابع map است. فرض کنید تابعی به نام grade نوشته ایم که در آن نمرات را در قالب اعداد انگلیسی نمایش می دهد. حالا یک لیست از نمرات دانشجویان داریم که می خواهیم آن ها را به اعداد تبدیل کنیم. راه حل متداول این است که با یک حلقه for تمام عناصر این لیست را بخوانیم و تابع را روی آن اجرا کنیم و نتیجه را در یک لیست جدید ذخیره کرده و نمایش دهیم.
اما به کمک تابع map می توانیم این کار را بسیار سریعتر و ساده تر انجام دهیم.
بازنمایی دستورات فوق در پایتون در تصویر این پست ذکر شده است.

پایتون برای مالی در تلگرام https://www.tg-me.com/no/Python4Finance/com.python4finance
پایتون برای مالی در بله https://ble.im/no/Python4Finance/com.python4finance



tg-me.com/python4finance/405
Create:
Last Update:

اجرای یک تابع بر روی تمام عناصر یک لیست با تابع map

یکی از توابع زیبای پایتون تابع map است. فرض کنید تابعی به نام grade نوشته ایم که در آن نمرات را در قالب اعداد انگلیسی نمایش می دهد. حالا یک لیست از نمرات دانشجویان داریم که می خواهیم آن ها را به اعداد تبدیل کنیم. راه حل متداول این است که با یک حلقه for تمام عناصر این لیست را بخوانیم و تابع را روی آن اجرا کنیم و نتیجه را در یک لیست جدید ذخیره کرده و نمایش دهیم.
اما به کمک تابع map می توانیم این کار را بسیار سریعتر و ساده تر انجام دهیم.
بازنمایی دستورات فوق در پایتون در تصویر این پست ذکر شده است.

پایتون برای مالی در تلگرام https://www.tg-me.com/no/Python4Finance/com.python4finance
پایتون برای مالی در بله https://ble.im/no/Python4Finance/com.python4finance

BY Python4Finance




Share with your friend now:
tg-me.com/python4finance/405

View MORE
Open in Telegram


Python4Finance Telegram | DID YOU KNOW?

Date: |

That strategy is the acquisition of a value-priced company by a growth company. Using the growth company's higher-priced stock for the acquisition can produce outsized revenue and earnings growth. Even better is the use of cash, particularly in a growth period when financial aggressiveness is accepted and even positively viewed.he key public rationale behind this strategy is synergy - the 1+1=3 view. In many cases, synergy does occur and is valuable. However, in other cases, particularly as the strategy gains popularity, it doesn't. Joining two different organizations, workforces and cultures is a challenge. Simply putting two separate organizations together necessarily creates disruptions and conflicts that can undermine both operations.

How to Use Bitcoin?

n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. “They have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. “It’s huge.”

Python4Finance from no


Telegram Python4Finance
FROM USA