Lesson 7 simplification


#1

I understand the answer to lesson 7 is:

spam=True
eggs=False

What I am wondering is how come you don't define spam with parenthesis. In other words, why is:

def spam():
spam=True
eggs=False

Incorrect?


#2

That would make a function called spam. The function would then generate two local variables.


#3

I don't understand. What would those two variables mean, and how could i make it acceptable?


#4

Use the code you said you knew was correct.


#5

I knew it was correct by guessing it was. I just want to understand why it shouldn't be defined. I'm just confused mannnnnnn :frowning:


#6

You want a variable, not a function.


#7

As @cadecodes said, codecademy will not let you pass without doing the lesson as they intended. In this case, you need to declare seperate variables, not create them inside of a function! :slightly_smiling:


#8

You don't need to define variables. You just declare them and start using them. Functions, on the other hand, must be defined before they can be used. That's because variables only hold a value, but functions do something. So you have to say what the function is supposed to do before you can use that function.


#12

as a result, What should we do? Because I don't get it anything I did what you all say about issue but I cannot pass the chapter


#13

Define two variables.