78 questions
a=0def vartest(a): a=1 return aprint(vartest(a))Why is it said that a is not defined when a=0 is cleared? Since a in the function and a outside of the function are different variables, we defined a=1 ...
The code below is a function that functions to search for a string in a string. I have a question because I don't understand something while analyzing the code.The first of the two codes below works f...
function getNumber(str) { if (typeof str == 'string') { if (isNaN(str)) { return -1; } } else { return parseFloat(str); } } } else if (typeof str == 'boolean') { if (str) { return 1; } } else ...
// a function that counts how many times a particular letter (ch) is in a given word function countCharacter(word, ch) { var count = 0; var res = word.toUpperCase(); var count = res.indexOf(ch); if(co...
#define _CRT_SECURE_NO_WARNIGS#include<stdio.h>#include<stdlib.h>int factorial(int n);int main() { int n; scanf(%d, &n); printf(%d\n, factorial(n)); return 0;}int factorial(int n) { if...
import randomQ = int(input('drawing lots!') Please enter a quota.')numbers = list(range(1, Q + 1))R1 = random.choice(numbers)print('{} and''.format.(R1))numbers.remove(R1)R2 = random.choice(numbers)pr...
I am a freshman in college who entered Python. I tried to express the dead rule operation as a function, but the first elif keeps showing an error window called invalid syntax with a red line. I don't...
There was no big problem when the function had 1 variable.However, there was a problem because there were many variables and many declarations.This program applies avg (where to store the mean) and st...
import randomcum=random.sample(range(1,10),4)print(cum)def check_list(listname,input_num): listname=[] while len(listname)<=input_num-1: z=0 num=int (Enter a number) listname.append(num) for k ...
Hello, I'm asking you a question because I don't understand while studying data analysis with PandaSas.def make_generation(age): if age == -1: return 'Not entered' elif age // 10 >= 4: Late 30s e...
« | - 3 - | » |
© 2024 OneMinuteCode. All rights reserved.