The first number
Write a function to receive numeric and if that number,The first numberWas TRUE and otherwise False returned
Write a function to receive numeric and if that number,The first numberWas TRUE and otherwise False returned
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
num = int(input("please enter the number you want to check\n")) if num > 1: for i in range(2, num): if (num % i) == 0: print("the number is not prime, false") print(str(i) + " times " + str(num//i) + " is "+ str(num)) break else: print("the number is prime,true") elif(num == 1): print("the number is not prime") else: print('enter a positive value')
def x(n): for i in range(2,n): if n % i == 0: return False return True num = int(input("num: ")) if x(num): print("True") else: print("False")
n = int(input("number:")) numbers=[] for i in range(2,n+1): numbers.append(i) for g in range(2 , max (numbers)): for i in range(g, max(numbers)): if i*g in numbers: numbers.remove(i*g) print("***") if n in numbers: print(n," is a prime number.") else: print(n," is not a prime number.")
while True: try: number = int(input("Enter number: ")) if number <= 0: print("Enter a positive number") continue break except ValueError: print("Invalid Input!") result = True if number == 1: result = False for i in range(2, number): if number % i == 0: result = False break print(result)
def is_prime(n): # Check if n is less than 2 if n < 2: return False # Survey of division from 2 to attraction n for i in range(2, int(n**0.5) + 1): if n % i == 0: return False return True # Example to use the function number = int(input("عدد را وارد کنید: ")) if is_prime(number): print(f"{number} عدد اول است: True") else: print(f"{number} عدد اول نیست: False")
num = int(input("enter your number:")) x = True for i in range(2,num): if num % i == 0: print(False) break else: print(x)
def Aval(n) :
count = 0
for i in range(1 , n + 1) :
if n % i == 0 :
count += 1
if count == 2 :
return True
else :
return False
Submitting answers is currently unavailable.
Write a program that receives a number of input and the factoriel calculates and prints it
Suppose we have the following 2 tables Users-> name, idbooks-> User_id, id, name 1- Write a query that shows user-related books at No. 2- Write a query to user names a ...
Write a program that receives a text and a word from the user, search the word in the text, and as the example below and then put the word * and print the text in the output. Example: Input1: Hello. My name is hooshang. I ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.