How to hardcode a variable in python functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to hardcode a variable in python functions

def adds_numbers(x, y): return x + y my_sum = adds_numbers(10,31) print(my_sum) Error: the my_sum variable is not hard-coded.

24th Sep 2020, 12:04 PM
Abhi
Abhi - avatar
2 Answers
+ 1
To my mind, it is hard-coded because the program doesn't accept user input, so my_sum will always be 41. May I ask you to explain further what you are after and maybe also why you want this?
24th Sep 2020, 12:23 PM
Russ
Russ - avatar
0
Hi Russ, This is one of my task to complete but I struck here.
24th Sep 2020, 1:39 PM
Abhi
Abhi - avatar