Telegram Group & Telegram Channel
ساختار شرطی در پایتون
در صورتی که بخواهیم شروط مختلفی را ضمن یک ساختار شرطی بررسی کنیم از elif استفاده می کنیم. فرض کنیم می خواهیم نمره یک دانش آموز را در سه حالت بزرگتر از 10 مساوی 10 و کوچکتر از 10 مقایسه کنیم. حاصل چیزی شبیه به زیر خواهد بود:
grade=15
if grade > 10 :
print("Greater than 10")
elif grade == 10 :
print("equal to 10")
elif grade < 10 :
print("less than 10")
چند نکته: به ساختار تو رفتگی ها در دستور if دقت کنید. هر کدام از این تو رفتگی ها (که بعد از علامت : در خط قبل قرار دارد) یک بلوک را تشکیل می دهد.
برای مقایسه تساوی باید از == استفاده کنید (علامت = باعث ایجاد خطا می شود. = برای انتصاب است)
در صورتی که بخواهید ذیل یک شرط چندین خط کد بنویسید باید تو رفتگی را برای تمام خطوط آن بلوک رعایت نمایید.

#ساختار_شرطی
#آموزش_پایتون

#مقدمات

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

پایتون برای مالی در بله https://ble.im/cn/Python4Finance/com.python4finance



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

ساختار شرطی در پایتون
در صورتی که بخواهیم شروط مختلفی را ضمن یک ساختار شرطی بررسی کنیم از elif استفاده می کنیم. فرض کنیم می خواهیم نمره یک دانش آموز را در سه حالت بزرگتر از 10 مساوی 10 و کوچکتر از 10 مقایسه کنیم. حاصل چیزی شبیه به زیر خواهد بود:
grade=15
if grade > 10 :
print("Greater than 10")
elif grade == 10 :
print("equal to 10")
elif grade < 10 :
print("less than 10")
چند نکته: به ساختار تو رفتگی ها در دستور if دقت کنید. هر کدام از این تو رفتگی ها (که بعد از علامت : در خط قبل قرار دارد) یک بلوک را تشکیل می دهد.
برای مقایسه تساوی باید از == استفاده کنید (علامت = باعث ایجاد خطا می شود. = برای انتصاب است)
در صورتی که بخواهید ذیل یک شرط چندین خط کد بنویسید باید تو رفتگی را برای تمام خطوط آن بلوک رعایت نمایید.

#ساختار_شرطی
#آموزش_پایتون

#مقدمات

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

پایتون برای مالی در بله https://ble.im/cn/Python4Finance/com.python4finance

BY Python4Finance




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

View MORE
Open in Telegram


Python4Finance Telegram | DID YOU KNOW?

Date: |

That growth environment will include rising inflation and interest rates. Those upward shifts naturally accompany healthy growth periods as the demand for resources, products and services rise. Importantly, the Federal Reserve has laid out the rationale for not interfering with that natural growth transition.It's not exactly a fad, but there is a widespread willingness to pay up for a growth story. Classic fundamental analysis takes a back seat. Even negative earnings are ignored. In fact, positive earnings seem to be a limiting measure, producing the question, "Is that all you've got?" The preference is a vision of untold riches when the exciting story plays out as expected.

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

Python4Finance from cn


Telegram Python4Finance
FROM USA