Absolute value calculation
Write a program that receives a number from the input and prints it in the output
Write a program that receives a number from the input and prints it in the output
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
while True: x = int(input("tell me a number: ")) if x >= 0: print(x) elif x < 0: print(-x)
y = int(input("Enter a number: ")) if y >= 0: print(y) else: print(-y)
num1 = int(input('enter your number : ')) abs_num1 = abs(num1) print(f" The absolute value of the number {num1} is : {abs_num1}")
number = int(input("please enter a number: ")) print("ghadre motlagh = ", abs(number))
def ghadrmotlagh(): x = int(input("enter number1:")) y = int(input("enter number2:")) z = abs(x-y) return z print(ghadrmotlagh())
num = float(input ("Please enter number: ")) print(abs(num))
n = float(input())
if n * (-1) <= n :
print(n)
else :
print(n * (-1))
Submitting answers is currently unavailable.
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.