Posts by manuel • 71 points
9 posts
-
1
votes1
answer217
viewsQ: How to check if a string is None?
I have the following code: st = "" if None == st: print True else: print False There is a form of the string st be equal to None in order to type the value on the screen True?…
-
1
votes1
answer81
viewsQ: Ocaml vs Python - Function return value
I have the following function written in ocaml let rec pow((x:int), (y:int)) : int = if y=0 then 1 else x * pow(x,y-1) ;; let pr = 13;; let bs = 31;; let getvalor num ch1 ch2 tam = (num * bs +…
-
0
votes1
answer31
viewsQ: Write word in succession until the end of the cycle
let palavra="1234567";; let tamanho=String.length palavra;; for i = 0 to 6 do print_string String.sub palavra i (tamanho-i); print_string "\n"; done;; I tried to execute the code, but it won’t…
-
1
votes2
answers205
viewsQ: How to pass command result to a bash variable?
I have the following command: cat frutas.txt | tail -n 1 | cut -d: -f 1 This command returns an integer to the terminal. How do I send this value to a variable? I tried something like this: resl=cat…
-
1
votes1
answer47
viewsQ: How to place successive matrices in vector
I have the following matrices of 100 elements: int [][]matriz1 = { {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0},…
-
-2
votes2
answers70
viewsQ: How to remove 1 element from the Labels vector
Label[] posi={textf99, textf00, textf01, textf02, textf03, textf04, textf05, textf06, textf07, textf08, textf09, textf10b, textf11, textf12, textf13, textf14, textf15, textf16, textf17, textf18,…
-
0
votes1
answer147
viewsQ: Insert in list order in C
I have the following function: Nodo * insertOrder(Nodo *L,Nodo *nv){ //11,1,50,7,5 if(L==NULL){ return nv; } if(nv->id < L->id){ return (insertFirst(L, nv)); } int c=0; Nodo *aux2=L; Nodo…
-
0
votes2
answers58
viewsQ: Insert at the end of efficient-list
typedef struct NODO{ int custo; int linha; int coluna; struct NODO *nseg[2]; }Nodo; Nodo * insertLastEfi(Nodo *L,Nodo *nv){ Nodo * aux =L; if (L==NULL) { return nv; } while (L->nseg[1]!=NULL) {…
-
0
votes1
answer2628
viewsQ: How to generate random numbers but with some restrictions in python?
import random v=[1,7,15] x=random.choice(v) How do I generate more numbers "1" than "15"? At 10000 times, choose 1 number and at the end: number 1 must have left about 40%. number 7 must have left…