Exercise 4.18


#1

Hi there, just posted this in Spanish yesterday but no reply, used to be a Spanish forum but now seems to have disappeared...
I cannot go through this one either removing the "tomato" string or removing the break clause inside the For, I always get the message 'The Else is not being run' even it is, could someone help?

BTW, admin please bring language forums back or enable links to access the old posts. As the course is available in other languages, a language forum is still needed.


#2

Hi @davicillus,

Could you please post your entire code? I will have a look at it and try to help you the best I can.

Here's a little trick:

Whenever you would like to paste code, since this forum supports Markdown you can use three backticks before and after your code block like so:

```
def my_func(x):
my_var = 0
if x > my_var:
sum = my_var + x
else:
print "Odelay!"
return sum
```

and it will retain proper indentation and even have nifty syntax highlighting:

def my_func(x):
    my_var = 0
    if x > my_var:
      sum = my_var + x
    else:
      print "Odelay!"
    return sum

14/18 Cambialo
#3

Hello denisaltroy, first of all thanks for replying.

I finally managed to pass the exercise, the code was correct. There was some kind of issue with my browser and cookies (or whatever is saved) interfering with the Codeacademy interpreter. Solution: using another browser, I guess deleting cookies and/or temporary files would have worked too.
If someone else faces this problem, they could try that.

Here the code (in Spanish) that passed, just changed the "tomato" item inside the list

frutas = ['banana', 'manzana', 'naranja', 'melon', 'pera', 'uva']

print 'Tienes...'
for f in frutas:
	if f == 'tomate':
		print 'El tomate no es una fruta!' # (En realidad sí es una fruta.)
		break
	print 'una', f
else:
	print 'Una rica seleccion de frutas!'