• Register
search
Log In

Recent questions tagged arrays

1 vote
1 answer 10 views
Problem : I am new to C programming. I have recently started working on exercise. Please find below my code for your reference: int mydistinct(int a[], int n) { int i, k, j, count=0; int max = a[0]; for (i = 1; i < n; i++) { if (max < a[i]) { ... . In this case my code will only try to count 8,7,6,5 and it will return only four unique numbers. So I am looking for proper guidance in C programming.
asked May 19 Martin K 6.6k points
1 vote
1 answer 22 views
Problem : I am a student and I am trying to learn python. I like programming so trying my hand on Python but the code which I have written in Python is giving me very strange looking error shown as below for your reference. Error: unsupported operand type(s) for ... array1=[1,2,3,4,5]; encryptedArray=runEncrypt(array1,4); print(encryptedArray); Please guide me in fixing my above error in Python.
asked May 15 Martin K 6.6k points
2 votes
2 answers 53 views
Problem: I wrote the following code in python using numpy. But it gives me some error message. The code I wrote is: import numpy as np arrayone = np.array(['Human', 'Birds', 'Groots', 'Oats']) arraytwo = np.array(['Beach', 'Toast']) arraythree ... concatenate TypeError: only integer scalar arrays can be converted to a scalar index Can anyone sort out this error and solve this. Thanks in advance.
asked May 6 samhaz 5k points
1 vote
1 answer 8 views
Problem : I am very new to programming. I have recently started learning C programming. Please find below the one way of initializing the array: I have one doubt about my above program : Which of the following is not a correct way to initialize an array? int n[ 5 ] = { 0, 7, 0, 3, 8, 2 }; int m[3] = ... [1] 15};     printf("m[0] = %d  m[1] = %d   m[2] = %d\n", m[0], m[1], m[2]);     return 0; }
asked Apr 27 stewart 4k points
1 vote
1 answer 153 views
Problem : I am very new to programming. I need to write a program called swapAdj that must accept the array of integers and after that swap those elements at the adjacent indexes. For example consider the elements 0 and 1 are swapped by the program and after ... note if your array has the odd length then the program must keep final element unmodified. Please help me in writing above program.
asked Apr 7 morrisBson 3.2k points
1 vote
1 answer 10 views
Problem: Hello good souls, var myarr1 = [1, 2, 3, 4, 5]; var myarr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; I have two simple arrays like above. I want to sort out the common values between those two arrays. So can you find common elements in two arrays javascript for me? Please keep the program as simple as possible that I can understand easily. Thanks for your effort and valuable time buddy.
asked Apr 6 Gavin 15.2k points
1 vote
2 answers 52 views
Problem : I am beginner to numpy. I am trying to execute my code but I am facing below error. &ldquo;Valueerror: all the input arrays must have same number of dimensions&rdquo;. I want to have my all the arrays with a same shape. I am trying to fix above error from past couple of days but still unable to fix it. I am looking for some help in fixing above error.
asked Apr 4 morrisBson 3.2k points
1 vote
1 answer 17 views
Problem: I am doing a online course on python. I got an assginement from there. So I was trying to write a programm using numpy and matplotlib. I am new to python programming. The code I wrote is: import numpy import matplotlib.pyplot def ThisFunction(a): return ... .int(a) TypeError: only size-1 arrays can be converted to Python scalars Do anyone know why this error is happening, please help.
asked Apr 3 LizzyM 5.7k points
1 vote
1 answer 10 views
Problem: I was doing my coding practice of python using numpy. I wrote this code: def create_traini_data(): trainingday_data = [1100] for img in tqdm(os.listdir(TRAIN_DIR)): label = label_img(img) path = os.path.join(TRAIN_DIR, img) training_data.append([ ... = create_traini_data() traini = traini_data[:-400] It throws error: ValueError: setting an array element with a sequence Can anybody help?
asked Apr 3 LizzyM 5.7k points
1 vote
1 answer 16 views
Problem : I have very recently started to learn programming in Java. I am trying to execute my java code but I am facing the below error. &ldquo;Exception in thread "main" java.lang.arrayindexoutofboundsexception:&rdquo; I am unable to understand above error. Please find below my code: ... according to my debugger*/ myodd[j] = input[i]; j++; } return myodd; } Please help me in fixing above error.
asked Mar 30 morrisBson 3.2k points
0 votes
1 answer 16 views
I wrote some code in java: public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter size of array:"); int size = sc.nextInt(); int[] intArray = new int[size]; for ( ... .journaldev.exceptions.ArrayIndexOutOfBoundsExceptionExample.main(ArrayIndexOutOfBoundsExceptionExample.java:23) What is the problem in my code and why am I getting this kind of error?
asked Mar 14 LizzyM 5.7k points
0 votes
1 answer 22 views
Problem: Can any one help me in array programming? What happen when an individual element of an array is passed to a method?
asked Feb 22 maddi86 5.4k points
0 votes
1 answer 20 views
Problem: I am new and learning, I need help, can anyone help by filling in the blanks? The _________ is adequate for searching through small arrays? A) binary B) unary C) linear search D) relative E) None of these
asked Feb 21 maddi86 5.4k points
0 votes
1 answer 32 views
Problem: I am new and learning, I need help, can anyone help by filling in the blanks? A(n) ________ search uses a loop to sequentially step through an array? A) binary B) unary C) linear D) relative E) None of these
asked Feb 21 maddi86 5.4k points
0 votes
1 answer 25 views
Problem: I am new, I need help, can anyone help me by filling in the blanks?? ​The acronym ____________ refers to software that manages data stored in a database.​​ A) ​ERP B) SQL​ C) ​OLAP D) ​DBMS
asked Feb 19 maddi86 5.4k points
0 votes
1 answer 66 views
Problem: I am new in programming and stuck in a query, can anyone guide me? Write an expression that evaluates to True if the str associated with s starts with "p"?
asked Feb 17 maddi86 5.4k points
0 votes
1 answer 20 views
Problems: Can anyone give the right solution? To go to the end of an info page, press:? END n N ]
asked Feb 14 maddi86 5.4k points
0 votes
1 answer 50 views
Solutions: I am new in programming and my logic is not good, can anyone give the right solution? Write an expression that evaluates to true if and only if the C-string s equals the C-string "end"?
asked Feb 14 maddi86 5.4k points
0 votes
1 answer 271 views
Problem : I am having below error in a title, and I don't know what's wrong. It was working when I used np.hstack instead of the np.append, but I want to make this faster, so using append. time_list the list of floats heights is the 1d np.array of ... <module> axe_x.append(time_list[np.arange(j+n,j+(time_interval-n))]) TypeError: only integer arrays with one element can be converted to an index
asked Jan 24 jwilliam 3.9k points
1 vote
1 answer 105 views
Problem : I am trying to enter numbers for my array br_el[6], and also I want it to show me for what object I am entering my number! So when I want to compile it gives me the below error: "[Error] cannot pass objects of non-trivially-copyable type 'std::string {aka ... declare the string qr_naziv[6]; but my string didn't even bold so it didn't work for me, so looking for the solution on my error ?
asked Jan 10 alecxe 7.5k points