TGViewer
PyCoders (پایتون) PyCoders (پایتون) @python_rd · 4.1K subscribers
Post #2057 718
✨ بازی سنگ، کاغذ، قیچی یا Rock-Paper-Scissors

"""
Rock - Paper - Scissors
Python 3.x
"""

import random

def main():
print("✂️ سنگ - کاغذ - قیچی ✂️")
choices = ["سنگ", "کاغذ", "قیچی"]

while True:
print("\nانتخاب کن:")
print("1 = سنگ")
print("2 = کاغذ")
print("3 = قیچی")

move_str = input("عدد انتخابت؟ ")

if not move_str.isdigit():
print("❌ فقط عدد وارد کن.")
continue

move = int(move_str)
if move not in [1, 2, 3]:
print("❌ عدد باید 1، 2 یا 3 باشد.")
continue

player = choices[move - 1]
computer = random.choice(choices)

print(f"تو: {player} | کامپیوتر: {computer}")

# تعیین برنده
if player == computer:
print("🤝 مساوی!")
elif (player == "سنگ" and computer == "قیچی") or \
(player == "کاغذ" and computer == "سنگ") or \
(player == "قیچی" and computer == "کاغذ"):
print("🏆 تو بردی!")
else:
print("🤖 کامپیوتر برد!")

again = input("دوباره بازی کنیم؟ (y/n): ").strip().lower()
if again != "y":
print("🌟 بازی تمام شد! مرسی که بازی کردی.")
break

if __name__ == "__main__":
main()



با دوستاتون بازی کنید و لذتشو ببرین🫶🏻❤️

🐍 @python_rd
  • ❤ 1
  • 🔥 1
More from @python_rd
  1. Oct 17, 2026🔆 یادگیری پایتون با پروژه های ساده و جذاب 🔹 codeclubprojects.org/en-GB/python 🐍 @python…
  2. Oct 16, 2026🔆 یک سایت خوب پر از پادکست‌های مرتبط با زبان پایتون 🔹 talkpython.fm 🐍 @python_rd
  3. Oct 15, 2026🌐 خروجی این کد پایتون چیست؟ x = [1, 2, 3] y = x x += [4, 5] print(x) print(y) 🔹 گزینه‌ها…
  4. Oct 15, 2026🔆 آیا enumerate() بهتر از index-based loop است؟ 🔹 خیلی‌ها هنوز این شکلی می‌نویسند: items…
  5. Oct 15, 2026🔆 یک تله عجیب در پایتون: bool در واقع زیرکلاس int است 🔹 خیلی‌ها می‌دانند True == 1 و Fal…
  6. Oct 13, 2026کوییز پایتون 🔆 خروجی اجرای کد زیر چیست؟ t = (1, 2, [3, 4]) try: t[2] += [5] except TypeEr…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →