Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajustes de formatação. #136

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions book3/02-variables.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ porque esses números são representados em um formato chamado *ponto flutuante*
\index{tipo int}
\index{class!int}
\index{tipo float}
\index{class!float
\index{class!float}


~~~~ {.python .trinket height="120"}
Expand Down Expand Up @@ -81,7 +81,7 @@ Quando você digita um inteiro muito grande, você deve estar tentado a usar uma

Bom, não é o que esperávamos! Python interpreta 1,000,000 como uma sequência de inteiros separada por vírgulas, a qual é mostrada com um espaço entre cada inteiro.

index{erro semântico}
\index{erro semântico}
\index{error!semantic}
\index{mensagem de erro}

Expand Down Expand Up @@ -257,7 +257,7 @@ O operador de divisão em Python 2.x dividiria dois inteiros e truncaria o resul
0
~~~~

Para obter a mesma resposta em Python 3.x use a divisão inteira(//inteiro).
Para obter a mesma resposta em Python 3.x use a divisão inteira (//inteiro).

~~~~ {.python .trinket height="160"}
>>> minute = 59
Expand Down Expand Up @@ -486,9 +486,9 @@ Comentários são mais úteis quando eles documentam características não-obvia

Esse comentário é redundante com o código e inútil:


~~~~ {.python}
v = 5 # atribuir 5 para v
~~~~

Esse comentário contém informação útil que não está no código:

Expand Down
16 changes: 8 additions & 8 deletions book3/03-conditional.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Execução condicional
A fim de escrever programas úteis, nós sempre necessitamos da habilidade de checar condições e de mudar o comportamento do programa de acordo com elas. *Declarações Condicionais* nos dão essa habilidade. A forma mais simples é a declaração `if`:

~~~~ {.python}
if x > 0 :
if x > 0:
print('x é positivo')
~~~~

Expand All @@ -137,7 +137,7 @@ Não existe limite para o número de declarações que se pode aparecer no corpo
\index{declaração!pass}

~~~~ {.python}
if x < 0 :
if x < 0:
pass # necessitamos tratar os valores negativos!
~~~~

Expand Down Expand Up @@ -180,9 +180,9 @@ na qual existem duas possibilidades e a condição determina
qual delas deve ser executada. A sintaxe se dá da seguinte forma:

~~~~ {.python}
if x%2 == 0 :
if x%2 == 0:
print('x é par')
else :
else:
print('x é ímpar')
~~~~

Expand Down Expand Up @@ -334,13 +334,13 @@ ele simplesmente falha, mostrando uma mensagem de erro não amigável:

~~~~
python fahren.py
Insira a temperatura em Fahrenheit:72
Insira a temperatura em Fahrenheit: 72
22.22222222222222
~~~~

~~~~
python fahren.py
Insira a temperatura em Fahrenheit:fred
Insira a temperatura em Fahrenheit: fred
Traceback (most recent call last):
File "fahren.py", line 2, in <module>
fahr = float(ent)
Expand Down Expand Up @@ -369,13 +369,13 @@ o Python sai desse bloco e executa os comandos no bloco 'except'.

~~~~
python fahren2.py
Insira a temperatura em Fahrenheit:72
Insira a temperatura em Fahrenheit: 72
22.22222222222222
~~~~

~~~~
python fahren2.py
Insira a temperatura em Fahrenheit:fred
Insira a temperatura em Fahrenheit: fred
Por favor, insira um número
~~~~

Expand Down
2 changes: 1 addition & 1 deletion book3/04-functions.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Finalmente, `str` converte seu argumento para uma string:
\index{Função str}
\index{Função!str}

~~~
~~~~
{.python}
>>> str(32)
'32'
Expand Down
4 changes: 2 additions & 2 deletions code3/fahren.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
inp = input('Enter Fahrenheit Temperature: ')
fahr = float(inp)
ent = input('Insira a temperatura em Fahrenheit: ')
fahr = float(ent)
cel = (fahr - 32.0) * 5.0 / 9.0
print(cel)
6 changes: 3 additions & 3 deletions code3/fahren2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inp = input('Enter Fahrenheit Temperature:')
ent = input('Insira a temperatura em Fahrenheit:')
try:
fahr = float(inp)
fahr = float(ent)
cel = (fahr - 32.0) * 5.0 / 9.0
print(cel)
except:
print('Please enter a number')
print('Por favor, insira um número')