Telegram Group & Telegram Channel
🎲#گام_به_گام

💻 کدنویسی

🔣 دستورات پایه در پایتون: قسمت دوم

متغیرها (variables)
متغیرها محفظه‌هایی برای ذخیره مقادیر داده‌ها هستند.

🔴 ایجاد متغیرها
پایتون هیچ فرمانی برای اعلان متغیر ندارد.
یک متغیر در لحظه‌ای ایجاد می‌شود که برای اولین بار یک مقدار به آن اختصاص می‌دهید.
⬅️مثال:
x = 5
y = "John"

🟡 متغیرها نیازی به اعلان با نوع خاصی ندارند و حتی بعد از تنظیم می‌توانند نوع خود را تغییر دهند.
⬅️ مثال:
x = 4 # یک عدد است x
x = "Sally" # یک رشته است x حالا
print(x)

انتخاب‌کردن (casting)
اگر می‌خواهید نوع داده یک متغیر را مشخص کنید، این کار را می توان با casting انجام داد.

x = str(3)
y = int(3)
z = float(3)

نوع را دریافت کنید.
شما می توانید نوع داده یک متغیر را با تابع type() دریافت کنید.

⬅️ مثال
x = 5
y = "John"
print(type(x))
print(type(y))
خروجی پایتون:
<class 'int'>
<class 'str'>
👈 ادامه دارد....

#️⃣#کدنویسی
#️⃣#IDSchools
#️⃣#IDS
#️⃣#IDS_Math

✉️@IDSchools
✉️@IDS_Math
Please open Telegram to view this post
VIEW IN TELEGRAM



group-telegram.com/IDS_Math/91
Create:
Last Update:

🎲#گام_به_گام

💻 کدنویسی

🔣 دستورات پایه در پایتون: قسمت دوم

متغیرها (variables)
متغیرها محفظه‌هایی برای ذخیره مقادیر داده‌ها هستند.

🔴 ایجاد متغیرها
پایتون هیچ فرمانی برای اعلان متغیر ندارد.
یک متغیر در لحظه‌ای ایجاد می‌شود که برای اولین بار یک مقدار به آن اختصاص می‌دهید.
⬅️مثال:
x = 5
y = "John"

🟡 متغیرها نیازی به اعلان با نوع خاصی ندارند و حتی بعد از تنظیم می‌توانند نوع خود را تغییر دهند.
⬅️ مثال:
x = 4 # یک عدد است x
x = "Sally" # یک رشته است x حالا
print(x)

انتخاب‌کردن (casting)
اگر می‌خواهید نوع داده یک متغیر را مشخص کنید، این کار را می توان با casting انجام داد.

x = str(3)
y = int(3)
z = float(3)

نوع را دریافت کنید.
شما می توانید نوع داده یک متغیر را با تابع type() دریافت کنید.

⬅️ مثال
x = 5
y = "John"
print(type(x))
print(type(y))
خروجی پایتون:
<class 'int'>
<class 'str'>
👈 ادامه دارد....

#️⃣#کدنویسی
#️⃣#IDSchools
#️⃣#IDS
#️⃣#IDS_Math

✉️@IDSchools
✉️@IDS_Math

BY ریاضی، آمار و علوم کامپیوتر - مدارس میان‌رشته‌ای


Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260

Share with your friend now:
group-telegram.com/IDS_Math/91

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

I want a secure messaging app, should I use Telegram? Pavel Durov, a billionaire who embraces an all-black wardrobe and is often compared to the character Neo from "the Matrix," funds Telegram through his personal wealth and debt financing. And despite being one of the world's most popular tech companies, Telegram reportedly has only about 30 employees who defer to Durov for most major decisions about the platform. Right now the digital security needs of Russians and Ukrainians are very different, and they lead to very different caveats about how to mitigate the risks associated with using Telegram. For Ukrainians in Ukraine, whose physical safety is at risk because they are in a war zone, digital security is probably not their highest priority. They may value access to news and communication with their loved ones over making sure that all of their communications are encrypted in such a manner that they are indecipherable to Telegram, its employees, or governments with court orders. Despite Telegram's origins, its approach to users' security has privacy advocates worried. The regulator took order for the search and seizure operation from Judge Purushottam B Jadhav, Sebi Special Judge / Additional Sessions Judge.
from br


Telegram ریاضی، آمار و علوم کامپیوتر - مدارس میان‌رشته‌ای
FROM American