Posts by Jobert • 445 points
9 posts
-
2
votes1
answer76
viewsA: a program that reads 30 pairs of integer values, storing the smallest value in a variable x and the largest in y
I understood this problem a little differently: a program that reads 30 pairs of integer values That is, the program must read a pair of integer values (a, b) 30 times. Below is my solution, with…
-
1
votes1
answer45
viewsA: How to show a specific array that is in a JSON?
const input = { "id": "1", "addresses": [ { "num": "1", "addressType": "Comercial", "country": "Brasil", "postalCode": "89035200", }, { "num": "3", "addressType": "Comercial", "country": "Brasil",…
-
8
votes3
answers114
viewsA: Reading undesirable characters - Python
Has a very simple way using Regex: import re input = "João:saiu!! de%$ˆcasa" pattern = "[,&ˆ*!!:%\$\s]+" repl = " " output = re.sub(pattern, repl, input) print(output) # João saiu de casa You…
-
1
votes1
answer50
viewsA: How to access the index correctly for data in the same file?
There is a problem because not all data has the same length, so accessing these values from the indexes can cause unexpected results. So here’s another way to access this data in a simpler way and…
-
1
votes1
answer220
viewsA: Attributeerror: 'Nonetype' Object has no attribute'latitude' _ Python
NoteType means that instead of an instance of any class you are working with, you received the value None. This usually means that the function called failed or returned an unexpected result. In…
-
2
votes1
answer57
viewsA: Pass list of numbers from cartesian to polar
You can use the function zip to align the values of each list and perform coordinate conversion operation with the corresponding values: media_v1 = [20, 50] media_v2 = [30, 60] import cmath result =…
-
1
votes1
answer21
viewsA: Activity indicator in Swiftui
A new view called ProgressView was introduced with iOS 14 (Xcode 12) and can be used to indicate progress indefinitely if it is not used with values for the current state and total. The default…
-
5
votes1
answer52
viewsA: In a list list, how to sum each item of each list with the item of its respective position?
Well, in this case the lists can have different sizes, so we need to fill the positions of the smallest lists and then add the corresponding values. We can do this using zip_longest with fillvalue…
-
2
votes1
answer42
viewsA: How to show a View depending on a condition in Swiftui
You can use the @ViewBuilder to achieve this: @ViewBuilder var body: some View { if user.isAuthenticated { HomeView() } else { LoginView() } }…