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

Saeed Alghamdi4

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

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

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

إنجازات Saeed Alghamdi4

عضو مبتدئ

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

4

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

  1. import random num1 = random.randint(1, 12) num2 = random.randint(1, 12) while True: print('Choose 1 for Divison') print("Choose 2 for Subtract") mode = eval(input('enter number :')) if (mode == 1): if num1 < num2: num1, num2 = num2, num1 for i in range(5): num1 = random.randint(1, 12) num2 = random.randint(1, 12) x = eval(input(" what is " + str(num1) + " / " + str(num2) + " : ")) if x == (num1 // num2): print(" Right, the result of the question " + str(num1) + " / " + str(num2) + " = ", x) elif x != (num1 // num2): print(" You are wrong Because " + str(num1) + "/" + str(num2) + " = ", (num1 // num2)) Again = input("If you want to stop write stop Or if you want to continue, type yes : ") if (Again == "stop"): break elif (mode == 2): for i in range(5): num1 = random.randint(1, 12) num2 = random.randint(1, 12) if num1 < num2: num1, num2 = num2, num1 y = eval(input(" what is " + str(num1) + " - " + str(num2) + ":")) if y == (num1 - num2): print(" Right, the result of the question " + str(num1) + " - " + str(num2) + " = ", y) elif y != (num1 - num2): print(" You are wrong Because " + str(num1) + " - " + str(num2) + " = ", (num1 - num2)) Again = input("If you want to stop write stop Or if you want to continue, type yes : ") if (Again == "stop"): break else: print('You have entered an invalid value!') break سويت كذا مره اشتغل معي الكود بعدها صار يطلعلي خطا هل فيه مشكلة في الكود ولا صحيح
  2. operation = input(''' Please type in the math operation you would like to complete: - for subtraction / for division ''') number_1 = int(input('Enter your first number: ')) number_2 = int(input('Enter your second number: ')) if operation == '-': print('{} - {} = '.format(number_1, number_2)) print(number_1 - number_2) elif operation == '/': print('{} / {} = '.format(number_1, number_2)) print(number_1 / number_2) else: print('You have not typed a valid operator, please run the program again.') هذا اللي انا سويته اللي ماعرفت هو التكرار وتوقف البرنامج
  3. هذا المطلوب Write a program that helps the first-grade student to division and sub (if the student enters the phrase indicating division, the program will show the division question, and if the phrase indicating sub is entered, the program will show the sub question. For the student that entered the wrong operation, make sure to show a message showing that the student entered the wrong operation). After that, the program selects two integer numbers randomly from number 1 to 12, considering that number1> = number2, then the student must be asked to answer. The program will then display a message indicating if the answer is correct. If the answer is wrong, the program must display the correct answer. Repeat the previous process 5 times (the student must choose between division and sub
×
×
  • أضف...