0

My python code in Visual Code Studio is having some problems:

def calculate(n):
    sum = (n*(n+1))/2
    return sum


in_value = int(input(">"))
answer = int(calculate())
print(answer)

But I can not enter the input value in the output console: Why does that happen ? Thanks for answering

2
  • You don't use in_value anywhere in your code. This code should raise an exception because you don't pass a required argument (n) to your function calculate. Commented Feb 25, 2022 at 6:46
  • @Selcuk, and also calculate function is called without argument Commented Feb 25, 2022 at 6:48

1 Answer 1

2

You are not passing the in_value into calculate() function.

answer = int(calculate(in_value)) 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.