اذهب إلى المحتوى

Joseph Joseph

الأعضاء
  • المساهمات

    2
  • تاريخ الانضمام

  • تاريخ آخر زيارة

إنجازات Joseph Joseph

عضو مبتدئ

عضو مبتدئ (1/3)

1

السمعة بالموقع

  1. import random print("welcom to the coin Guessing Game") print("choose a method to toss the coin:") print("1. using random.random()") print("2. using random.randint()") choice = input("Enter your choie (1 or 2): ") #random.randint if choice=="1": random_1 = random.random() if random_1>=0.5: computer_result="tails" else: computer_result="heads" elif choice=="2": if random.randint(0 , 1) == 0: computer_result="tails" else: computer_result="heads" else: print("invalid choice :please select 1 or 2") user_choice= input("Enter your guess (Heads or atails) ") if user_choice.lower==computer_result.lower(): print("congratulation . you won") else: print("sorry you lost")
×
×
  • أضف...