+ 1
Hi, for the simple calculator project in python, I only get 1 case, the second case how do I get it?
A = 2; F = 7; print (A+F); D = 11;, E = 22; T = (D+E); print(T)
10 Réponses
+ 4
# How about this way.
def add(first, second):
return first + second
#add two numbers
#Enter first number
first = int(input())
#Enter second number
second = int(input())
sum = first + second
print(sum)
# this might work.
+ 2
Hi! in this kind of tasks, you don't need to insert values directly. leave it to the test program. imagine that you were asked to write a program to calculate two unknown numbers. how would you write it?
+ 1
# another way you could do this.
def add_numbers(a, f):
total = a + f
return total
print(add_numbers(2, 7))
def add_sum_numbers(d, e):
t = d+e
total = t
return total
print(add_sum_numbers(11, 22))
# did this help?
+ 1
it won't help, as you don't understand. these are assignments-projects that complete each module of the course. there you need to pass verification tests. users try to substitute direct values in the input data. although you need to do exactly the opposite. imagine that you need to write a calculator program where the input data is unknown to you. you need to perform actions on two unknown numbers!
+ 1
Cool 👌
0
I get out of an exit apart from the first one. Because I get one after another, do you need to come out the second apart from the other, like separating them?
0
I want one operation to come out apart from the other in the middle, how would I jump to take the second operation later?
0
yes, this option is suitable, but you have an extra add function, you do not call it anywhere in your program
0
Its made by me in c