0
hi my coding instor told me to make a calculator that find the average of two numbers can you pls tell me my erro
print("the is a progarm that find the average of two numbers:") num=int(input("enter you num the program will find the anwer:")) num2=int(input("enter you num the program will find the anwer:")) print=(f"finding the anwer pls stand back{num} {num2} {num}+{num2}//{num2}")
5 Answers
+ 4
dayeabasi kingsley ,
the issue is in the last line:
> print=(...) is not correct, the print function is shadowed
> the expression inside the f- string is not correct.
why you are not going to use a more simple way:
> take input for first number and store it in a variable
> take input for second number and store it in a variable
> add the 2 numbers and store the result in a variable
> output the result by dividing the sum of the numbers by 2
+ 2
19 hours ago brofar showed you the answer why are asking again?
Do you know how get the average of two numbers?
+ 2
use the existing thread to show your attempt.
https://www.sololearn.com/Discuss/3338938/?ref=app
your last print() is incorrect.
as already mentioned, you are not yet calculating the average. To calculate the average, sum up the 2 number and **then** divide by 2.
0
first of all coding is supposed to be user friendly and simple
num1 = int (input("enter the first number :"))
num2 = int (input("enter the second number :"))
avg = (num1 + num2)/2
print (f"the average of {num1},{num2} is : {avg} ")
and note avg equation also
0
num1 = int(input('Enter your first number : '))
num2 = int(input('Enter your second number : '))
print(f"The average of {num1} and {num2} is : {(num1+num2)/2}")