Posts by Diovana Valim • 203 points
10 posts
-
5
votes3
answers896
viewsQ: How to insert a character in the middle of the sentence
I am implementing a function that checks whether within a word there are two equal letters in a row, and if so, add an x between the two letters to separate them. Example: Entree: pizza Exit: pizxza…
-
0
votes1
answer72
viewsQ: Inheritance in classes
I have a challenge to create a small system in Python that manages associations in a club. For this, I created the following class: class Carteira: def __init__(self,numero,atividade,bilhete):…
pythonasked Diovana Valim 203 -
0
votes2
answers112
viewsQ: Separate a string into blocks according to similarity
I have the following challenge proposed: input: "aaaaabbbbccccccaaaaa" output : "5a4b6c7a" And I made the following code to solve it: def conta_numero_letras(string): armazena = '' for letra in…
pythonasked Diovana Valim 203 -
1
votes3
answers472
viewsQ: How to add a new key to a dictionary?
I have the following challenge: input : "conaz test" output: {'a': 1, ' ': 1, 'c': 1, 'e': 2, 'o': 1, 'n': 1, ’s': 1, ’t': 2, 'z': 1} And implemented the following code: def…
pythonasked Diovana Valim 203 -
1
votes1
answer48
viewsQ: Output values are leaving without space
I have the following problem to solve: Cryptography (Greek: kryptós, "hidden", and gráphein, "written") is the study of the principles and techniques by which information can be transformed from its…
-
2
votes2
answers110
viewsA: Compare dictionary key with an integer
I was able to find the solution. I used the get command to get the values associated with the letters. def letra_q_mais_aparece(frase): alfabeto = {"a":0, "b":0, "c":0, "d":0, 'e':0, 'f':0, 'g':0,…
-
2
votes2
answers110
viewsQ: Compare dictionary key with an integer
My teacher gave a problem to be solved by the class. Given a sentence, we want to know which letter appears the most, always working with lowercase letter, that is, disregarding the distinction…
-
2
votes3
answers233
viewsQ: Error using append after merging two lists into one
My teacher passed the following problem to be solved and translated to Python: Consider that we have two lists of people names, sedo that these lists are already in lexicographic (alphabetical)…
-
0
votes1
answer69
viewsQ: Function Return after Eoferror [Python]
Good afternoon, I need to solve the following problem using the While structure: Given a sequence of real values, calculate your average. The command given by the teacher was: while True: try: valor…
pythonasked Diovana Valim 203 -
4
votes1
answer2163
viewsQ: How to compare elements of the same index in a list
I have the following problem to solve: Consider that Mariazinha has performed a multiple choice approval. We now want to determine the number of hits Mariazinha. To this end, the template and…
pythonasked Diovana Valim 203