VS Code - Flake8

Asked

Viewed 104 times

0

Good afternoon,

In the code below, from and radius ** 2 are not being recognized. When checking the error with from, the following message appears.

inserir a descrição da imagem aqui

Does anyone have any idea what this problem might be?

  • Good evening! Don’t put your code as an image, people need to play your code quickly!

  • 1

    Yeah, you’re right, I hadn’t thought of that. Thanks for the tip, good night!

1 answer

3


The problem is in:

raio = input("Informe o raio: ")

This is because you are not defining the variable type (int,str,float,bool) input will receive. By default python input will always receive a String which has its type defined as str or is not receiving a numerical value.

  • So the python is trying to raise to 2 a String and not a int is a numerical value That’s why you’re making a mistake.

To solve just define the type of input as follows:

raio = int(input("Informe o raio: "))

Or if you want to use a floating point number (Broken numbers):

raio = float(input("Informe o raio: "))

I hope I’ve helped!

  • Perfect Lucas, very well explained and really worked. Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.