Hi, for the simple calculator project in python, I only get 1 case, the second case how do I get it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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)

18th Apr 2021, 12:21 PM
Jose Reinaldo Parra Morales
Jose Reinaldo Parra Morales - avatar
10 Answers
+ 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.
18th Apr 2021, 8:45 PM
Steve Nova
Steve Nova - avatar
19th Apr 2021, 3:05 PM
Aakash Mitra
Aakash Mitra - avatar
+ 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?
18th Apr 2021, 1:11 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 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?
18th Apr 2021, 6:56 PM
Steve Nova
Steve Nova - avatar
+ 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!
18th Apr 2021, 8:35 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Cool 👌
18th Apr 2021, 9:00 PM
Steve Nova
Steve Nova - avatar
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?
18th Apr 2021, 12:34 PM
Jose Reinaldo Parra Morales
Jose Reinaldo Parra Morales - avatar
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?
18th Apr 2021, 12:39 PM
Jose Reinaldo Parra Morales
Jose Reinaldo Parra Morales - avatar
0
yes, this option is suitable, but you have an extra add function, you do not call it anywhere in your program
18th Apr 2021, 8:53 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Its made by me in c
19th Apr 2021, 3:05 PM
Aakash Mitra
Aakash Mitra - avatar