Why isn't this simple code working?


#1

I’m doing exercise 9 on the free python course and can’t figure out what i am doing wrong.

It asks me to define a variable cucumbers, bigger than 1 and needs to be an integer.

I am writing "cucumbers = 3 " and it keeps saying it is wrong.

https://imgur.com/a/8rjIu (Image showing the problem).


#2

I trust you are not writing it in quotes?

const cucumbers = 3

#3

I am not writing it in quotes, i thought that for integer variables there is no need for quotes?


#4

There is no need for quotes on any variable. If quoting inline code, use a single back tick on the code.

`cucumbers = 3`

That way we don’t get confused when we see code in quotes. The back ticks will mark down the code inline.

To post a block of code, use three back ticks before and after…

```
cucumbers = 3
cost_of_cucumbers = 3.25
total_cost = cucumbers * cost_of_cucumbers
```

which will render in the post like so…

cucumbers = 3
cost_of_cucumbers = 3.25
total_cost = cucumbers * cost_of_cucumbers

#5

I understand but this is still not working and shouldn’t the code cucumbers = 3 suffice?


#6

Can’t say. Please post a link to the exercise. Thanks.


#7

https://www.codecademy.com/courses/learn-python/lessons/python-syntax/exercises/numeric-datatypes


#8

Sorry, was giving JavaScript.

cucumbers = 3

is enough to meet the requirements of step 1.


#9

I’m experiencing the same issue. I assume that its just a recent bug?


#10

Also experiencing the same thing!


#11

Same problem, and the rest of the lessons after this has the same issues. Pretty broken for new members overall…


#12

I am going through this course and getting the same error.
It should just be cucumbers = 3
That is not working though.


#13

A friend and I are experiencing the same issue. Make sure to report this as a bug at the bottom of the left side of the exercise window.


#14

Experiencing the same. Correct code is not being recognised in exercise 9 and every exercise following this. Very frustrating!


#15

So does this mean that everybody is stuck on exercise 9? lol I’m stuck there too.


#16

Yeah, this is where I’m at, too. Will just send a bug report and wait for it to be fixed. No big.


#17

Try this. Worked for me, might work for you.

cucumbers = int(2)
price_per_cucumber = float(3.25)

#18

The intended solution works for me. Is anyone else experiencing this error?


#19

Thanks, but it appears to be working as it should now.