[Solved] How do I print a list of elements in array in JavaScript?

Here you are: var array = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’.split(”); for (var i = 0; i < array.length; i++) { var str=””; for (var j = 0; j <= i; j++) { if (array[j] == ‘E’) str += ‘3’; else str += array[j]; } document.querySelector(‘span’).innerHTML = document.querySelector(‘span’).innerHTML + str + ‘<br />’; } <span></span> Hope this helps. 9 … Read more

[Solved] Decrease an INT by 10% each round in C

The three statements after for are the initialization, the test condition for continuing the loop, and the statement repeated on each loop. We want to initialize delayTime to 50,000. We want to continue if delayTime is greater than or equal to 100. And we want to multiply it by 0.9 each loop (preferably without doing … Read more

[Solved] Working with two unknown integers

public static void main(String[] args) { System.out.println(“sum: ” + sum(10, 12)); System.out.println(“evens: ” + evens(10, 20)); System.out.println(“odds: ” + odds(10, 20)); System.out.println(“primes: ” + primes(0, 100)); } public static int sum(int from, int to) { int sum = 0; for (int i = from; i <= to; i++) { sum += i; } return sum; … Read more

[Solved] Python maths quiz random number [closed]

Use a for loop: for num in range(5): # Replace “print” below, with the code you want to repeat. print(num) To repeat all questions, excluding “whats your name..” include the part of the code you need in the loop: import random name=input(“What is your name?”) print (“Alright”,name,”Welcome to your maths quiz”) score=0 for question_num in … Read more

[Solved] C# string compression

Ok i got it correct. Had to implement int helper = i; due to i being lost in 2nd for loop, in else statement. Answer: static string Compression(string test) { string result = string.Empty; for (int i = 0; i < test.Length; i++) { int helper = i; int counter = 1; for (int j … Read more

[Solved] How to loop over an array of variables with the same form of name? [closed]

If you want to do all the columns in your dataframe: for col in df.columns: sns.countplot(df[col]) . Otherwise, following the pattern in your question: for i in range(1,11): column=’id_’+”{0}”.format(i).zfill(2) sns.countplot(df[column]) that will go through the numbers 1-10 and set column to the correct column name. zfill will make sure that for single digit numbers, column … Read more