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

💻 کدنویسی

0️⃣1️⃣ دستورات پایه در پایتون: قسمت دهم

🔣مختلط
اعداد مختلط با یک "j" به عنوان قسمت موهومی نوشته می شوند:
🟣 مثال
x = 3+5j
y = 5j
z = -5j

print(type(x))
print(type(y))
print(type(z))
خروجی پایتون:
<class 'complex'>
<class 'complex'>
<class 'complex'>
🔣 تبدیل نوع
می توانید با متدهای ()int()، float و ()complex یک نوع را به نوع دیگر تبدیل کنید:
🟣 مثال
x = 1 # int
y = 2.8 # float
z = 1j # complex

#convert from int to float:
a = float(x)

#convert from float to int:
b = int(y)

#convert from int to complex:
c = complex(x)

print(a)
print(b)
print(c)

print(type(a))
print(type(b))
print(type(c))
خروجی پایتون
1.0
2
(1+0j)
<class 'float'>
<class 'int'>
<class 'complex'>

❗️توجه: نمی توانید اعداد مختلط را به نوع اعداد دیگری تبدیل کنید.

🔣عدد تصادفی
پایتون یک تابع تصادفی () برای ساخت یک عدد تصادفی ندارد، اما پایتون یک ماژول داخلی به نام random دارد که می‌توان از آن برای ساخت اعداد استفاده کرد:

🟣 مثال
ماژول تصادفی را وارد کنید و یک عدد تصادفی بین 1 و 9 نمایش دهید:
import random

print(random.randrange(1, 10))
خروجی پایتون:
1

👈 ادامه دارد....

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

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



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

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

💻 کدنویسی

0️⃣1️⃣ دستورات پایه در پایتون: قسمت دهم

🔣مختلط
اعداد مختلط با یک "j" به عنوان قسمت موهومی نوشته می شوند:
🟣 مثال
x = 3+5j
y = 5j
z = -5j

print(type(x))
print(type(y))
print(type(z))
خروجی پایتون:
<class 'complex'>
<class 'complex'>
<class 'complex'>
🔣 تبدیل نوع
می توانید با متدهای ()int()، float و ()complex یک نوع را به نوع دیگر تبدیل کنید:
🟣 مثال
x = 1 # int
y = 2.8 # float
z = 1j # complex

#convert from int to float:
a = float(x)

#convert from float to int:
b = int(y)

#convert from int to complex:
c = complex(x)

print(a)
print(b)
print(c)

print(type(a))
print(type(b))
print(type(c))
خروجی پایتون
1.0
2
(1+0j)
<class 'float'>
<class 'int'>
<class 'complex'>

❗️توجه: نمی توانید اعداد مختلط را به نوع اعداد دیگری تبدیل کنید.

🔣عدد تصادفی
پایتون یک تابع تصادفی () برای ساخت یک عدد تصادفی ندارد، اما پایتون یک ماژول داخلی به نام random دارد که می‌توان از آن برای ساخت اعداد استفاده کرد:

🟣 مثال
ماژول تصادفی را وارد کنید و یک عدد تصادفی بین 1 و 9 نمایش دهید:
import random

print(random.randrange(1, 10))
خروجی پایتون:
1

👈 ادامه دارد....

#️⃣#کدنویسی
#️⃣#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/155

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

In December 2021, Sebi officials had conducted a search and seizure operation at the premises of certain persons carrying out similar manipulative activities through Telegram channels. "Someone posing as a Ukrainian citizen just joins the chat and starts spreading misinformation, or gathers data, like the location of shelters," Tsekhanovska said, noting how false messages have urged Ukrainians to turn off their phones at a specific time of night, citing cybersafety. At its heart, Telegram is little more than a messaging app like WhatsApp or Signal. But it also offers open channels that enable a single user, or a group of users, to communicate with large numbers in a method similar to a Twitter account. This has proven to be both a blessing and a curse for Telegram and its users, since these channels can be used for both good and ill. Right now, as Wired reports, the app is a key way for Ukrainians to receive updates from the government during the invasion. Russian President Vladimir Putin launched Russia's invasion of Ukraine in the early-morning hours of February 24, targeting several key cities with military strikes. Friday’s performance was part of a larger shift. For the week, the Dow, S&P 500 and Nasdaq fell 2%, 2.9%, and 3.5%, respectively.
from us


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