Posts by Matheus Andrade • 205 points
13 posts
-
2
votes4
answers295
viewsQ: Print null or non-null in Python array
If matrix has only zero print 'null' if not print 'not null' I did so: m=[[0,0,0],[0,0,0],[0,0,0]] soma1=0 for novo1 in m[0]: soma1+=novo1 soma2=0 for novo2 in m[1]: soma2+=novo2 soma3=0 for novo3…
-
3
votes3
answers871
viewsQ: How to separate characters from a string to a Python list?
How can I convert a string (a word, for example) into a list? entrada: a='carro' saída: ['c', 'a', 'r', 'r', 'o'] I know that by using split, turn into list gets the whole word, like to know if a…
-
2
votes2
answers1014
viewsQ: Find the maximum and minimum number in a list in a string
I have the following file: a = '1 0 10 2 3' I want to print the highest value and the lowest, so I used the max() and min() but it only counts the unit. I did it this way: a='joao 1 0 10 2 3'…
-
-2
votes1
answer981
viewsQ: Elaborate a program to read a feedback with ten python objective questions
Elaborate a program to read a template with ten objective questions provided as a string with ten characters relative to the correct alternatives (each answer is indicated by ːA' or 'a', ?B' or 'b',…
pythonasked Matheus Andrade 205 -
-1
votes1
answer100
viewsQ: calculate area and print it in another txt file in python
I have an area.txt file: quadrado;2 retangulo;2;3 I want to create another txt file so it looks like this: quadrado;2;4 retangulo;2;3;6 I did it this way but it’s wrong: arq=open('area.txt','r')…
pythonasked Matheus Andrade 205 -
0
votes1
answer133
viewsQ: add number and delete n in python
I have the txt file: NOME,n1,n2 JOAO,8,5 MARIA,5,6 PEDRO,0,9 I want to add up the numbers, I did it this way: arq=open('pergunta.txt','r') conteudo=arq.readlines() arq.close() for i in conteudo:…
pythonasked Matheus Andrade 205 -
0
votes1
answer546
viewsQ: How to open a txt file and use to print what I want
I made the following code: def caixaAlta(texto): return texto.upper() def ultimosNomes(nomeInteiro): lista = nomeInteiro.split(' ') if lista[-1].lower() == 'junior' or lista[-1].lower()=='sobrinho'…
pythonasked Matheus Andrade 205 -
1
votes3
answers316
viewsQ: Exercise changing last element
exercise: Write a function that receives a phrase and an old word and a new word. The function should return a string containing the phrase original, but with the last occurrence of the old word…
pythonasked Matheus Andrade 205 -
2
votes3
answers155
viewsQ: Simple question about the title() command
if I put for example the name: Roberto justo da silva using the title he gets like this: Roberto Justo Da Silva How do I make the command title do not change the word 'da' to look like this: Roberto…
-
2
votes2
answers112
viewsQ: Implement a program that has a name and only has the last name and first name
I made him this way: nome=input('Digite seu nome completo:').title() lista=nome.split() print(lista) print(lista[-1],',',lista[0]) But when it’s time to print, it looks like this: Fulano , Ciclano…
pythonasked Matheus Andrade 205 -
0
votes1
answer172
viewsQ: Create a program that receives a line of text and counts the vowels showing the respective Histogram
exercico: Prepare a program that receives a line of text and counts the vowels showing the respective Histogram a in the following form: Example: Last line of text: "Next fourth line of text is…
pythonasked Matheus Andrade 205 -
2
votes3
answers98
viewsQ: Doubt in my code is not printing correctly
question: Using the text file notes_students.dat write a program that calculates the minimum and maximum score of each student and prints the name of each student along with their maximum and…
pythonasked Matheus Andrade 205 -
4
votes1
answer1959
viewsQ: calculate a row-by-line list media in python
question: Using the text file notes_students.dat write a program that averages each student’s grades and prints each student’s name and average. filing cabinet: jose 10 15 20 30 40 pedro 23 16 19 22…