Jump to content
Fórum Script Brasil
  • 0

Não estou conseguindo imprimi


marcos_regato

Question

Eu estou usando Python3.4, não estou conseguindo imprimir. Alguém poderia me ajudar

# -*- coding: latin1 -*-

from random import randint

class RedeNeural():
	def __init__(self):
		self.entrada1 = random.randint(1,5)
		self.entrada2 = random.randint(1,5)
		self.peso1 = random.randint(1,5)
		self.peso2 = random.randint(1,5)
	#end_def

	def ativar():
		
		result = self.entrada1*self.peso1 + self.entrada2*self.peso2
		if result >= 0:
			print(result,"ativo")
		else:
			print(result ,"não ativo")
		#end_if
	#end_def


#end_main
#end_class

Obrigado pela ajuda

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Bem simples colega marcos

você usou : from random import randint

então não deve fazer: random.randint(1,5)

use: randint(1,5)

e: def ativar(self) #quando o metodo pertence a uma classe você deve usar o self dentro do parentese

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      652k
×
×
  • Create New...