Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

0 votes
Example = 0

def main():

Would this be acceptable?

asked in CSC201 by (108 points)

1 Answer

0 votes

Right now, we only have one function, main. The accumulator variable would need to be used within main so there would be no reason to have a variable defined outside of main.

So if the question is should you be doing this in the Rock, Paper, Scissors program, then answer is no.

In general, is it possible to have such variables. Yes, but in general, they should not be used unless there is a compelling reason to have a global variable rather than a variable defined within a function.

answered by (4.2k points)
...