What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-21 13:20:10
python list comprehension multiple for
""" List comprehension goes through the loops in the order you'd expect. Outer loops (first loops) are executed first, then inner loops. """ numbers = [1, 2, 3, 4, 5] letters = ['a', 'b', 'c', 'd', 'e'] list_comprehension =... Add solution -
Javascript 2022-03-20 02:25:33
9.6.4. Beyond for Loops // Input Validation // while loops
const input = require('readline-sync'); let num = input.question('Please enter a positive number:'); num = Number(num); while (num <= 0) { num = input.question('Invalid input. Please enter a positive number:'); num = Number(num); } /*This prog... Add solution -
Javascript 2022-03-16 22:30:12
javascript loop through arrya
var data = [1, 2, 3, 4, 5, 6]; // traditional for loop for(let i=0; i<=data.length; i++) { console.log(data[i]) // 1 2 3 4 5 6 } // using for...of for(let i of data) { console.log(i) // 1 2 3 4 5 6 } // using for...in for(let i in data) { con... Add solution -
Python 2022-03-06 04:25:04
how to get matrix element in the form of matrix in python
# A basic code for matrix input from user R = int(input("Enter the number of rows:")) C = int(input("Enter the number of columns:")) # Initialize matrix matrix = [] print("Enter the entries rowwise:") # For use... Add solution -
Python 2022-03-03 06:20:01
how to print a list nicely python
# Creating a list. Can also be floats and intagers list = ["a", "b", "c", "d", "e", "f", "g"] # Have a for loop and then print the answer index of the variable in the loop(i) for i in ... Add solution -
Javascript 2022-02-28 07:35:02
javascript array clear
let aray = [1,2,3,4,5,6,7,8,9,10]; //as with most coding there are several ways you can do anything //see whichever works best for your scenario //set the array to equal a blank array array = []; //set the array's length to 0 array.length = 0; //using... Add solution