Discussioni Q&A
def add(x, y):
return x + y
def do_twice(func, x, y):
return func(func(x, y), func(x, y))
a = 5
b = 10
print(do_twice(add, a, b))
Please explain step by step
Which is caller here?
Explain the 3rd and 4th line ?
why in 4th line we write add(add(x,y),add(x,y)) which is function of 1st line ?
how can we write function after return statement insted of (x+y+x+y )=30?
0 Voti
2 RisposteMoney Rate Income
1 Voto
1 RispostaPython 3
0 Voti
1 RispostaHELP WITH JS
4 Voti
1 RispostaPattern using JS
0 Voti
2 Risposte1
1 Voto
6 Rispostefunction can_i_enter(age)
if (age < 6) { document.write ("you are not allowed to watch Dead pool after 6:00pm.");}
else if (age>=6 && age<17) {document.write("you must be accompanied by a guardian who is 21 or older.");}
else if (age>=17 && age<25) {document.write ("you are allowed to watch Dead pool, right after you show some ID. ")}
else if (age>=25) { document.write ("Yah! you can watch Dead pool with no strings attached!");}
else { document.write ("Invalid age. ");}
can_i_enter (24);
0 Voti
9 RisposteHelp me fix this code
1 Voto
1 RispostaOOP Goblin Game
0 Voti
1 RispostaOr in if?
0 Voti
2 Rispostepyrhon
-1 Voto
2 RisposteRestart Button
0 Voti
2 RisposteHello guys right now I am kinda of new in python
my question is related to the function call len()
len() its print out the character but here it's the confusing part, I am working with a list let me explain an example
players
['lee', 'bob', 'moe', 'joe']
len(players)
4
why it's giving me 4 item in the list I thought len it counts the characters and if I do this it give me the correct somewhat answer what I am seeking,
len(players [-1])
3
0 Voti
8 RisposteMethod in python
0 Voti
2 Rispostewhat will be output??
#include <iostream>
using namespace std;
int main(int a)
{
cout << a << "\n";
return 0;
}
int main(char *a)
{
cout << a << endl;
return 0;
}
int main(int a, int b)
{
cout << a << " " << b;
return 0;
}
int main()
{
main(3);
main("Subodh");
main(9, 6);
return 0;
}
if output is compilation compilation error then how can we overload "main" function in C++
0 Voti
5 Rispostepython 3
0 Voti
1 Risposta9
2 Voti
6 RispostePopolare oggi
Coding for Cybersecurity
1 Votes
Need help
1 Votes
Pointers in c#
1 Votes
How can i isntall modules
1 Votes