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: |

But the Ukraine Crisis Media Center's Tsekhanovska points out that communications are often down in zones most affected by the war, making this sort of cross-referencing a luxury many cannot afford. Under the Sebi Act, the regulator has the power to carry out search and seizure of books, registers, documents including electronics and digital devices from any person associated with the securities market. Crude oil prices edged higher after tumbling on Thursday, when U.S. West Texas intermediate slid back below $110 per barrel after topping as much as $130 a barrel in recent sessions. Still, gas prices at the pump rose to fresh highs. Pavel Durov, Telegram's CEO, is known as "the Russian Mark Zuckerberg," for co-founding VKontakte, which is Russian for "in touch," a Facebook imitator that became the country's most popular social networking site. Channels are not fully encrypted, end-to-end. All communications on a Telegram channel can be seen by anyone on the channel and are also visible to Telegram. Telegram may be asked by a government to hand over the communications from a channel. Telegram has a history of standing up to Russian government requests for data, but how comfortable you are relying on that history to predict future behavior is up to you. Because Telegram has this data, it may also be stolen by hackers or leaked by an internal employee.
from jp


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