Telegram Group & Telegram Channel
# حلقة for
تستخدم في loop
في لغة بايثون تستخدم لتنفيذ سلسلة من الأوامر بشكل متكرر لعدة عناصر في تسلسل محدد.
تسمح لنا استخدام for
بتنفيذ نفس الكود لكل عنصر في التسلسل، وذلك بدون الحاجة إلى تكرار الأوامر يدويًا لكل عنصر.

فلنقم بتوضيح استخدام "for" مع بعض الأمثلة وتعريف

التعريف :
حلقة "for" في بايثون تستخدم لتكرار تنفيذ كود معين لكل عنصر في تسلسل. تستخدم لمعالجة وتحليل التسلسلات وتطبيق أوامر محددة على كل عنصر على حدة.

استخدامات "for" في لغة بايثون:
1. تنفيذ كود لكل عنصر في قائمة:
يعتبر هذا الاستخدام شائعًا لتنفيذ الأوامر للعناصر في قوائم. توفر "for" طريقة مريحة لتنفيذ نفس الكود لكل عنصر في القائمة.
مثال :
fruits = ["apple", "banana", "cherry"]

for fruit in fruits:
print(fruit)


Output :

apple
banana
cherry


2. تنفيذ كود لكل عنصر في سلسلة:
يمكن استخدام "for" لتنفيذ أوامر لكل حرف في سلسلة محددة.


word = "Hello"

for char in word:
print(char)


Output :

H
e
l
l
o


3. تنفيذ كود لعدد محدد من المرات:
باستخدام وظيفة
range()
في بايثون، يمكننا تكرار تنفيذ الأوامر لعدد محدد من المرات.


for i in range(5):
print(i)


Output:

0
1
2
3
4

#note

في loop يتم حساب الأرقام من "zero" "0"
مثلا في حساب العادي

12345
حساب loop
01234

لذلك نلاحظ تم توقف عند رقم 4 لانو بفعل تم طباعة 5 أرقام
اذا تريد إظهار الرقم كل عليك انك تزود واحد و هكذا.
:)
end

www.tg-me.com/sg/telegram/com.t3lampython

#note
إذا في شخص يريد يتعلم لغة برمجة dart
الخاصة بي flutter
يدخل على قناة عند اكتمال القناة 100 سوف يبدأ الشرح
Flutter
مختص ببرمجة وتطوير تطبيقات الهاتف أندرويد او ios
والأن المجال في تطور و يشمل أشياء كثيرة مثل web Applications و الخ etc
رابط القناة 👇

@t3lamdart

See you :)



tg-me.com/t3lampython/98
Create:
Last Update:

# حلقة for
تستخدم في loop
في لغة بايثون تستخدم لتنفيذ سلسلة من الأوامر بشكل متكرر لعدة عناصر في تسلسل محدد.
تسمح لنا استخدام for
بتنفيذ نفس الكود لكل عنصر في التسلسل، وذلك بدون الحاجة إلى تكرار الأوامر يدويًا لكل عنصر.

فلنقم بتوضيح استخدام "for" مع بعض الأمثلة وتعريف

التعريف :
حلقة "for" في بايثون تستخدم لتكرار تنفيذ كود معين لكل عنصر في تسلسل. تستخدم لمعالجة وتحليل التسلسلات وتطبيق أوامر محددة على كل عنصر على حدة.

استخدامات "for" في لغة بايثون:
1. تنفيذ كود لكل عنصر في قائمة:
يعتبر هذا الاستخدام شائعًا لتنفيذ الأوامر للعناصر في قوائم. توفر "for" طريقة مريحة لتنفيذ نفس الكود لكل عنصر في القائمة.
مثال :
fruits = ["apple", "banana", "cherry"]

for fruit in fruits:
print(fruit)


Output :

apple
banana
cherry


2. تنفيذ كود لكل عنصر في سلسلة:
يمكن استخدام "for" لتنفيذ أوامر لكل حرف في سلسلة محددة.


word = "Hello"

for char in word:
print(char)


Output :

H
e
l
l
o


3. تنفيذ كود لعدد محدد من المرات:
باستخدام وظيفة
range()
في بايثون، يمكننا تكرار تنفيذ الأوامر لعدد محدد من المرات.


for i in range(5):
print(i)


Output:

0
1
2
3
4

#note

في loop يتم حساب الأرقام من "zero" "0"
مثلا في حساب العادي

12345
حساب loop
01234

لذلك نلاحظ تم توقف عند رقم 4 لانو بفعل تم طباعة 5 أرقام
اذا تريد إظهار الرقم كل عليك انك تزود واحد و هكذا.
:)
end

www.tg-me.com/sg/telegram/com.t3lampython

#note
إذا في شخص يريد يتعلم لغة برمجة dart
الخاصة بي flutter
يدخل على قناة عند اكتمال القناة 100 سوف يبدأ الشرح
Flutter
مختص ببرمجة وتطوير تطبيقات الهاتف أندرويد او ios
والأن المجال في تطور و يشمل أشياء كثيرة مثل web Applications و الخ etc
رابط القناة 👇

@t3lamdart

See you :)

BY learn python { تعلم بايثون }




Share with your friend now:
tg-me.com/t3lampython/98

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

How to Invest in Bitcoin?

Like a stock, you can buy and hold Bitcoin as an investment. You can even now do so in special retirement accounts called Bitcoin IRAs. No matter where you choose to hold your Bitcoin, people’s philosophies on how to invest it vary: Some buy and hold long term, some buy and aim to sell after a price rally, and others bet on its price decreasing. Bitcoin’s price over time has experienced big price swings, going as low as $5,165 and as high as $28,990 in 2020 alone. “I think in some places, people might be using Bitcoin to pay for things, but the truth is that it’s an asset that looks like it’s going to be increasing in value relatively quickly for some time,” Marquez says. “So why would you sell something that’s going to be worth so much more next year than it is today? The majority of people that hold it are long-term investors.”

telegram from sg


Telegram learn python { تعلم بايثون }
FROM USA