[Solved] Python list not picking up min and max values correctly

You need to insert ints in the list instead of strings, just modify: item = input(“Enter a number to add to the list: “) noNumbers.append(item) By: item = int(input(“Enter a number to add to the list: “)) noNumbers.append(item) 7 solved Python list not picking up min and max values correctly

[Solved] How to iterate over Array List and modify elements inside the object in Java?

Assuming that class CatchesItem has time field defined as LocalDateTime, the check for today’s timestamp may be implemented as follows: import java.time.*; // … LocalDate today = LocalDate.now(); for (CatchesItem item : items) { if (today.equals(item.getTime().toLocalDate())) { item.setAmount(item.getAmount() + 5); // add some value to amount } } items.forEach(System.out::println); Output (for the input data as … Read more

[Solved] List all class objects

You can use a List to keep a list of classes (or any number of different collections). To do so, you could do something like this: List<releaseitem> myList = new List<releaseitem>() { new releaseitem(“ARTIST”, “TRACK 01”, “2014”), new releaseitem(“ARTIST”, “TRACK 02”, “2016”), new releaseitem(“ARTIST”, “TRACK 03”, “2012”), new releaseitem(“ARTIST”, “TRACK 04”, “2011”) }; foreach (releaseitem … Read more

[Solved] Android App Crushing Unexpectedly [closed]

Since you are using Arrays.asList to create your list, this list is unmodifiable, you cannot add or delete any element. Arrays.asList: Returns a fixed-size list backed by the specified array. So when you get to the line facts.remove(randomNumber); you get an Exception like the following (just guessing because you have not shared any stacktrace or … Read more

[Solved] Adding a Method

Sure, what you can do is create a method that takes in a list of students, gathers information about the new student from the user, and then adds a new student to the list. It would also need to ensure that if the list passed in was null, then it would initialize the list. I’m … Read more

[Solved] Foreach on Json based on value [closed]

Here is a crude example, that uses the Newtonsoft.Json nuget package, you can work from and use as inspiration perhaps. It groups by table name and then gets the list for each one. You may want to do it differently I’m not sure. var o = JsonConvert.DeserializeObject<root>(json); var groups = o.tabla.GroupBy(t => t.nombretabla); foreach (var … Read more

[Solved] Tournament Program [closed]

The error you have comes up in your method of printing out the results: for i in range(len(teams)): print(team[i],team[i+1]) First of all, you have team instead of teams in the print statement, which is actually the string where you were storing user input, and should be ‘-1′ by the time you’re printing scores. You’re getting … Read more

[Solved] Schrodingers JSON – when working with a json doc it is erroring as both a list and a dict

As @Hitobat mentioned in commend – you have list with dictionary inside so you have to use [0] to get this dictionary. Or you have to use for-loop if you have more elements on list data = [{‘_id’: ‘5f563c1bf8eaa9d98eca231f’, ‘allEnabledDs’: None, ‘allEnabledIdSor’: None, ‘correlationFilterEntitySource’: True, ‘created_at’: ‘2020-09-07T13:56:43.469Z’, ‘dsConnectionList’: None, ‘folderToLabelMapping’: None, ‘idConnectionList’: None, ‘identityResolutionScan’: False, … Read more