Posts by Fabricio Paiva • 340 points
20 posts
-
-8
votes3
answers2879
viewsA: Run script with Python: command "python3" is not recognized
In Windows it is not necessary to say which version of Python, just type python and the file name with the extension .py. In your case it would look like this: python somador.py In Unix environments…
-
0
votes2
answers300
viewsA: Doubt in PA code in Python
No need to create the term variable. Follow the code a little changed: pri_termo = int(input('Digite o primeiro Termo: ')) razao = int(input('Digite a Razão da PA: ')) cont = 1 while cont <= 10:…
pythonanswered Fabricio Paiva 340 -
-5
votes3
answers360
viewsQ: I can’t find the code error
Could someone point out to me the error of this code: valor_hora = float(input('Valor da hora trabalhada: ')) qtd_horas_trabalhadas = int(input('Quantidade de horas trabalahadas: ')) salario_bruto =…
-
2
votes3
answers2675
viewsA: Is it possible to include more than one variable per input in Python?
Valueerror: Empty separator Instead of . split(""), make . split(" ") Just remembering that the input returns a string, that is, if you want to use as operands you have to transform to integer or…
-
0
votes2
answers49
viewsA: Doubt loop FOR in C
The FOR continues as long as the condition is true, and not the contrary as I think you’re thinking... Note: there are two problems in your code: zero exponent and negative exponent. Good old IF…
canswered Fabricio Paiva 340 -
2
votes3
answers450
viewsA: Comparison of Vector regardless of position
By readjusting your code: #include<stdio.h> int main(void) { int vetor[3] = {10,20,5}; int vetor1[3]= {20,50,15}; int i, j, vetoresIguais; for(i = 0, vetoresIguais = 0; i < 3; i++) { for(j…
canswered Fabricio Paiva 340 -
4
votes1
answer87
viewsQ: What happens to memory space after the use of a local variable?
At the end of the execution of a function its local variables are "destroyed", correct? The spaces in memory have any values, in C we can notice when ordering to print a variable that we did not…
-
0
votes2
answers101
viewsA: How to handle printf in C language
#include <stdio.h> int main(void) { int x, y; printf("Digite dois valores para definir a posição [x, y]\n"); scanf("%d %d", &x, &y); …
-
4
votes2
answers439
viewsQ: Size of type int with short and long prefixes in C
My architecture is Unix, so by default the size of type int is 4 bytes, so far so good. In Luis Dama’s book he states that short and long prefixes solve the problem for portability of programs…
-
3
votes3
answers607
viewsQ: Declaring a string in C
When setting the size of a string and not using all the space in the reserved memory, after the 0 the rest will be released? char nome[40] = "carlos"; In the above example I declare a string with…
-
0
votes2
answers66
viewsQ: Setting Data Output in C
I would like the output to show the tables of each operation side by side, and not one under the other (which is the form that is printing). Here is the code: #include <stdio.h> #include…
casked Fabricio Paiva 340 -
4
votes2
answers234
viewsQ: Variable declaration assignment in C
Is it necessary to assign a value to a variable in C once we declare it? I ask because an old programmer told me that it is necessary, because, if we do not declare at first, the compiler could…
-
1
votes4
answers79
viewsQ: Problem with a search algorithm on a vector and does not find
The algorithm I am developing should look for an element in any vector. The error happens when the element is not found. vetor = [] for i in range(1, 5): vnum = int(input('Digite um valor: '))…
-
0
votes1
answer42
viewsQ: Bubble Sort in python - Problem inserting values in list
Colleagues, I have a problem inserting values into a list, follow the thought: lista = [] for i in range(0, 4): lista[i] = int(input('Informe um numero: ')) for i in range(0, len(lista)-1): for j in…
python-3.xasked Fabricio Paiva 340 -
0
votes1
answer75
viewsQ: How to use the Time module together with the Sys module
I have a problem using the time.Sleep module together with the sys module. You’re not taking the break I put on the team.. import random import time import sys cores = {'fim': '\033[m', 'vermelho':…
-
0
votes1
answer270
viewsQ: How to adjust the width in the background-color in ccs
I’m having trouble adjusting the background-color of a table using css so that the background is all black and still on a margin to the sides, up and down. Width can be adjusted with width: #tabela{…
-
0
votes3
answers92
viewsA: Argument error in python 3.7
Try it that way: preco = float(input('Informe o valor do produto R$: ')) parcelamento = int(input('De seja parcelar em 3x sem juros ? [1]- SIM [2] - NAO : ')) valor_a_vista = preco - (preco * 0.1)…
pythonanswered Fabricio Paiva 340 -
-1
votes1
answer110
viewsQ: String transformation in python
'Cause this way there’s no mistake: print(f'Seu nome possui {len(nome.replace(" ", ""))} letras') But this one there: print(f'Seu nome possui {len(nome.replace(' ', ''))} letras') Python does not…
python-3.xasked Fabricio Paiva 340 -
0
votes1
answer38
viewsQ: HTML semantic and use of css3
Should the html tags in italic, underline and bold no longer be used and these visual-textual effects should be in charge of css3? With this wave of html semantic I got this doubt.
-
2
votes5
answers106673
viewsA: How to generate random numbers in Python?
Use the Random method combined with some class of it. ex: import random num = int(input('O computador pensou em um numero entre 0 e 5, você é capaz de advinhar? ')) sorteio = random.randint(0, 5) if…