Sitelet https://github.com/romulocraveiro/python-exercises
Skip to content

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exercícios em Python

Instituto Conhecimento Liberta

Curso de Programação e Algoritmos - Módulo Básico

Professor: Geneflides Laureno

Objetivos / Aims

  • Compartilhar anotações de aula, de pesquisa e aprendizagem.
  • Sharing notes of classes, searches and learning.

Notas de aprendizagem / Learning notes

  • Use a função len( ) para contar uma cadeia de caracteres. Ver aula11-input.py e tarefa-de-casa-aula13.py

  • Use function len ( ) to count a character chain. See aula11-input.py and tarefa-de-casa-aula13.py files.

  • Use a função count( ) para contar quantas vezes uma cadeia de caracteres (palavra, no caso) aparece no input. Ver tarefa-de-casa-aula11.py

  • Use function count( ) to count how many times a character chain (word in this case) appears in input. See tarefa-de-casa-aula11.py file.

  • Para fazer um comentário no código, use # em cada linha (não há recurso de comentário multilinhas, como /.../).

  • To make a comment in your code, use a # in each line (there isn't a feature to make multiline comments like /.../)

  • Sua linha de código está muito longa? Use \ para continuar na linha seguinte, mas atente para o espaço entre palavras.

  • Is your line of code too long? Use \ to continue in the next line, but mind the spaces between words.

  • Use a função lower( ) para normatizar o input de modo que todas as cadeias de caracteres fiquem com letra minúscula. Ver aula12-count-lower.py

  • Use function lower ( ) to standardize input in such a way that the character chains are lower cased. See aula12-count-lower.py file.

  • Use a sintaxe print(variavel[i]), sendo i a posição do índice do vetor numa cadeia de caracteres. Ver homework-aula12.py

  • Use the syntax print(variable[i]), as i is the array index position in a character chain. See homework-aula12.py file.

  • Use a função capitalize( ) quando precisar que uma cadeia de caracteres (uma string, uma palavra) tenha inicial maiúscula. Veja, por exemplo, em aula13-replace-split.py. Se eu não usar a função, caso o usuário decida começar a frase com "Refrigerante" o "Texto modificado" será impresso com inicial minúscula, o que não queremos que aconteça.

  • Use the capitalize( ) function when you need a character chain (a string, a word for instance) to be capitalized. See it, for example, in class13-replace-split.py file. If I don't use the function, and if the user decides to start the sentence with "Refrigerante" the "Texto modificado(Modified text)" will be printed with a lowercase initial, and we don't want that to happen.

  • O sinal de mais (+) não concatena slicing e sim somente strings. Nesse caso, usa-se a vírgula. Aliás, a diferença entre vírgula e sinal de adição é que aquela cria um espaço entre caracteres ou cadeias de caracteres, enquanto este só admite concatenar strings, e sem espaço entre elas. De qualquer forma, funcionaria usar vírgula para tudo em tarefa-de-casa-aula14.py

  • The plus sign (+) does not concatenate slicing but only strings. In this case, the comma is used. By the way, the difference between comma and plus sign is that the former creates a space between characters or character chains, while the latter only allows concatenating strings, and no space between them. Anyway, it would work to use comma for everything in homework-class14.py

  • Se quiser imprimir as últimas palavras de uma list (por exemplo, as 5 últimas), use esta sintaxe: variável[-5:]. Embora a última posição seja -1, se o inserirmos após os dois pontos, não será impresso o último termo, e sim até o penúltimo. Ver tarefa-de-casa-aula14.py

  • If you want to print the last words of a list (for example, the last 5), use this syntax: variable[-5:]. Although the last position is -1, if we insert it after the colon, the last term will not be printed, but the second to last one instead. See homework-class14.py file.

  • Para transformar um input (string por padrão) em número inteiro, use a sintaxe <variável = int(input())>

  • To convert an input (string by default) into an integer, use the syntax <variable = int(input())>.

  • If / else não precisa de chaves em Python (que ótimo, não?); ver aula15-if-else-int-input.py.

  • If / else doesn't need curly braces in Python (that's great, isn't it?); see class15-if-else-int-input.py.

  • Entretanto, o que conta no caso dos operadores de controle são as indentações. Por convenção, 4 espaços, mas fica a critério do usuário, desde que se mantenha consistente. Ver tarefa-de-casa-aula16-resolucao1.py

  • However, what matters in the case of control operators is the indentation. By convention, 4 spaces, but it is up to the user, as soon as they are consistent. See tarefa-de-casa-aula16-resolucao1.py

Tecnologias / Technologies

  • Python
  • Google Colab

Links

Autor / Author

Foto Nome/Name GitHub Likedin E-mail
Romulo Craveiro de Sousa Tartaruga Romulo Craveiro Linkedin romulocraveiro@gmail.com

About

Exercises with the programming language Python

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages