In what ways do we get out of if/else condition? java

I did this code: private static void fix (List<String> hg){ String k1 = hg.get(0); String k2 = hg.get(1); String k3 = hg.get(2); String k4 = hg.get(3); String k5 = hg.get(4); List <Character> d = new ArrayList<>(); for (int j = 0; j < k1.length(); j++) { d.add(j, k1.charAt(j)); } Iterator <Character> sdf = d.iterator(); while… Read More In what ways do we get out of if/else condition? java

how to make a switch

import java.util.Scanner; public class Main2 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int a=scan.nextInt(); int b=1; for (int i=1;i<=30;i++){ if(i%a==0){ b=1; System.out.print("X"); }else { System.out.print("O"); } } } } I drive 3 into the scanner the desired result XXXOOOXXXOOOXXXOOOXXX >Solution : Try this: if (i%a==0) { b = 1-b; } if(b==1){… Read More how to make a switch

Replace specific text values in a row of a dataframe based on a true condition on the row before

I am doing a text analysis from the congressional record, specifically when senators are speaking about each other. There are many instances where one senator refers to another who just finished speaking without naming them (ie: my colleague, my friend, etc). I am trying to replace those instances with their name. The speeches are split… Read More Replace specific text values in a row of a dataframe based on a true condition on the row before