Posts by Davi Mello • 420 points
10 posts
-
15
votes1
answer281
viewsA: What is Python Assignment Expressions 3.8?
The answer goes by levels. Simple concept: Complete concept: Example: How to use: References: Simple concept: We can say in a way " "simple" that is to define a variable and pass it as value at the…
-
0
votes3
answers108
viewsA: How to write a large amount of values per line in Python file?
OI , Bernardo, You could use python’s Join function. It will look like this: Form 1: f2 = open('saida.txt','w+') # Importante usar o w+ , salvar sem apagar o'que já está lá.…
pythonanswered Davi Mello 420 -
1
votes2
answers445
viewsA: How to concatenate value to a column of a table in csv?
Hi, there are two ways to do this, the most elegant and using a library for python called "pandas" this is the link for their website, it has how to install using python’s "Pip" and has all…
-
-2
votes1
answer258
viewsA: How do I stop For when the range is 5?
Hello, Voce can use it like this: for c in range(1,10): print('a,b,c') if c % 5: # Condição break The if c == 5: must be within the cycle for. If you want to skip only one cycle you can use the…
-
0
votes1
answer94
viewsA: How to store information in a Python (write) file?
Hi, yes it is possible to write. Let’s go by part. file=open("energia_nll2_R50A.dat","w") for i in range(1,n+1): for j in range(1,6): file.write("r[i],(ener[j]*alfa)") file.close() First let’s…
-
2
votes3
answers639
viewsA: How to compress python code 3?
To do this, we will use functions Amble, but you can rest assured it’s something simple. We can do it separately: The variable i we’ll leave for the end. First, let’s discuss the if and the print…
-
0
votes1
answer157
viewsA: Reuse function variables
Create an object outside the function and pass it as argument. Ex.: #!/bin/python3 class fake_global_variables(object): nome = '' def get_dados(memory): memory.nome = input('Nome :') return ('Que…
pythonanswered Davi Mello 420 -
0
votes1
answer1839
viewsQ: Python - Error in using import, module --- has in attribute
Hello, I’m writing the code for a university project, but when I try to import dependencies to some files, from Error. I created some package’s that have files that have dependencies, but they don’t…
-
2
votes1
answer1666
viewsA: If/Else condition in a column (python)
Hello, I’m sorry for any mistake in advance. By using the pandas, the row that is below the [, was put by the Pandas, is the table index, so it does not count, you can remove. Now, your…
pythonanswered Davi Mello 420 -
-1
votes2
answers349
viewsQ: Java code help (Beginner)
I wrote this code in java to study. (I’m learning) but when I try to create a new error object. Class Empresa : class Empresa { String nome = ""; String cnpj = ""; int numeroDeFuncionario = 1;…
javaasked Davi Mello 420