Write a simple python function to increase the value of any number by a constant "C=5" and write another simple function to update the value of "C" to any other value like 6,7,8, etc.# The required output is as:The incremented number is:15The incremented number is:110
Answers
Answered by
1
C = 5
increment = lambda n: f"The incremented number is: {n + C}"
def update_c(to):
global C
C = to
return f"Updated C to {to}"
print(increment((n := int(input("n: ")))), end = "\n\n")
print(update_c((to := int(input("to: ")))), end = "\n\n")
print(increment((n := int(input("n: ")))))
Similar questions