There are some problems with your solution. The increment in the cycle was being done right at the beginning so I would analyze an extra element, in:
while y<=n:
y=y+1
To know if a number is prime we have to try to divide by all who are in the middle and not just one, as happens here:
if (x % y==0 and x//y==0):
return x
Extending your solution and making it right:
def maior_primo(n):
x=0
y=n #começar do cima para baixo para poder sair no primeiro primo
while y>=1: #ciclo agora ao contrario até 1
for x in range(2, y + 1): #range nao inclui o ultimo, logo tem de ser y +1
if y % x == 0:
break
if x == y: #se chegou até y é porque nao deu para dividir por nenhum, logo primo
return x
y = y - 1
return 1 #se nao deu para achar nenhum primo retorna-se um
And you want us to guess what the language is?
– Jéf Bueno
Python by syntax
– Isac
This does not eliminate the use of xD tags
– Jéf Bueno
Sure, it was just a guess :D
– Isac