print (“Welcome to place the rabbit”)
print(“”“[‘
’, ‘
’, ‘
’]
[‘
’, ‘
’, ‘
’]
[‘
’, ‘
’, ‘
’]”“”)
print(“Where should the rabbit go?
”)
str_choice = input(“Please choose a row and a column:”)
int_choice = int(str_choice)
rabbit = 22
if int_choice == rabbit:
print(“Success …”)
print(“”“[‘
’, ‘
’, ‘
’]
[‘
’, ‘
’, ‘
’]
[‘
’, ‘
’, ‘
’]”“”)
else:
print(“Game over!”)
4 إعجابات
لا المستخدم يجب ان يحدد مكان الارنب بالتحديد ولا يجب ان يكون دائما 22
هذا هو الكود الصحيح
print("welcome to the place the rabbit!")
field=[['🌿', '🌿', '🌿'],['🌿', '🌿', '🌿'],['🌿', '🌿', '🌿']]
print(f"{field[0]} \n{field[1]} \n{field[2]}\n")
print("where should the rabbit will go? 🐇")
position=input("please choose a row and a column ")
# يجب تحديد الروه لوحده والكلوم لوحده
row=int(position[0])
column=int(position[1])
# هنا بنحدد المكان الي المستخدم عايز يحط فيه الارنب
field[row-1][column-1] = '🐇'
print(f"{field[0]} \n{field[1]} \n{field[2]}\n")
6 إعجابات
شكرا أوي 
أنا كتبت الكود اللي كتبته بس عدلت عليه:
print (“Welcome to place the rabbit”)
field = [[“
,
,
”] ,
[“
,
,
”] ,
[“
,
,
”]]
print(f"{field[0]}“)
print(f”{field[1]}“)
print (f”{field[2]}")
print (“Where should the rabbit will go?
”)
position = input(“Please choose a row and a column:”)
row = int (position [0] )
column = int (position [1] )
field[row-1][column-1] = “
”
if len(position) != 2 or not position. isdigit() :
print (“Invalid format! Please enter two numbers without spaces.”)
if row<1 or row >3 or column <1 or column > 3 :
print (“Invalid input! Please enter numbers between 1 and 3.”)
field[row-1][column-1] = ‘
’
print(“Succes …”)
print(“field[0]”)
print(“field[1]”)
print (“field[2]”)
وبيديني الerror ده:
Welcome to place the rabbit
[‘
,
,
’]
[‘
,
,
’]
[‘
,
,
’]
Where should the rabbit will go? 
Please choose a row and a column:23
Traceback (most recent call last):
File “/data/user/0/com.kvassyu.coding.py/files/default.py”, line 12, in
field[row-1][column-1] = “
”
IndexError: list assignment index out of range
إعجاب واحد (1)
يجب عليك استخدام " " ليس ” في البرينت او عموما في اي string
لو مشيتي على الكود الي انا بعته من غير تعديلات هيشتغل كويس
إعجابَين (2)
المنتدى احيانا بيعدل العلامه دى (") وبيخليها (”)، بس مش دائما (اتوقع في ظروف محددة).
حتى هتلاحظ العلامة دي (”) في معظم الأكواد اللي على المنتدى بدون تنسيق (الكود ...
)
والحل هو إرسال الكود بالتنسيق هكذا :
وهيكون الناتج :
print ("Hello, World!")
4 إعجابات
هذا هو الكود الصحيح مع تعديلات حضرتك
print("Welcome to place the rabbit")
# إنشاء الحقل كقائمة ثنائية الأبعاد
field =[['🌿', '🌿', '🌿'],
['🌿', '🌿', '🌿'],
['🌿', '🌿', '🌿']
]
# طباعة الحقل كقائمة
print(field[0])
print(field[1])
print(field[2])
print("Where should the rabbit go? 🐇")
position = input("Please choose a row and a column : ")
# التحقق من صحة الإدخال
if len(position) != 2 or not position.isdigit():
print("Invalid format! Please enter two numbers without spaces.")
else:
row = int(position[0])
column = int(position[1])
if 1 <= row <= 3 and 1 <= column <= 3:
# وضع الأرنب في الموقع المختار
field[row-1][column-1] = "🐇"
print("Success!")
# طباعة الحقل بعد وضع الأرنب
print(field[0])
print(field[1])
print(field[2])
else:
print("Invalid input! Please enter numbers between 1 and 3.")
4 إعجابات
تمام، كده الكود شغال كويس 
إعجابَين (2)