Posts by Nelson Pereira • 17 points
4 posts
-
0
votes3
answers63
viewsA: Date printed in wrong format
There are several forms of date formatting, following some examples and their formations: Formatting Dates %d: dia do mês em 2 dígitos (13) %m: mês em 2 digitos (01) %y: ano em 2 dígitos (82) %Y:…
-
0
votes2
answers3178
viewsA: Format float in Python
You could use the string formatting operator for this: '%.2f' % 1.234 '1.23' '%.2f' % 5.0 '5.00' The operator result is a string, so you can store it in a variable, print etc. In the case of the use…
python-3.xanswered Nelson Pereira 17 -
-2
votes3
answers131
viewsA: Break string every 4 positions - Python
Adapt to your code print([codigo[i:i+4] for i in range(0, len(codigo), 4)])
-
2
votes3
answers17023
viewsA: Do while in python
Not quite. While: The while command causes a set of instructions to be executed while a condition is met. When the result of this condition becomes false, the execution of the loop is stopped, as…