+ 1

HELP def print_double(x): print(2*x) print_double(3) result??

8th Sep 2016, 5:09 PM
gala
gala - avatar
12 Answers
+ 7
What is the result of this code? def print_double(x): print(2 * x) print_double(3) ans: 6
8th Sep 2019, 10:08 PM
OUSSAMA ROMDHANI
OUSSAMA ROMDHANI - avatar
+ 1
ouu 6. thanks
8th Sep 2016, 5:19 PM
gala
gala - avatar
+ 1
6
26th Apr 2021, 1:16 PM
Moses Richard Aban DIING
Moses Richard Aban DIING - avatar
+ 1
def print_double(x): print(2*x) print_double(3)
20th May 2021, 5:01 PM
Madhavareddy
Madhavareddy - avatar
0
Not to difficult. Just exchange everywhere inside the function the x by 3. then you just have to calculate.
8th Sep 2016, 5:16 PM
Simon Weiss
0
What is the result of this code? def print_double(x): print(2 * x) print_double(3) Ans: 6
5th Dec 2020, 7:10 AM
IRFAN KHAN
IRFAN KHAN - avatar
0
the ans is 7
20th Dec 2020, 3:39 PM
Zubayer Hasan Shaad
Zubayer Hasan Shaad - avatar
0
yeah its 6
21st Dec 2020, 4:35 PM
Tika Azizah
Tika Azizah - avatar
0
ans :6
10th Feb 2021, 12:04 PM
Md Momin Uddin Hridoy
Md Momin Uddin Hridoy - avatar
- 1
You have just defined print_double as 2*x. But in order for it to work you need to put a variable in, you cant double the letter "X". So in the parentheses next to the def function you put in a letter x, that's telling python that the variable is x so when you put (2*x) you're essentially telling python to print 2*a number that you put in. So now everytime you put print_double(#enter number) the variable in the parentheses is going to follow the rule that you just defined, which would be printing it*2. So if you were to just put: def print_double(x): print(x) Anything you put in the parentheses for print_double() is going to follow the rule you just put down, so in this case all its doing is just printing it. So if I put print_double('hello world") it would just print hello world because that's the rule that I set it as.
8th Sep 2016, 7:52 PM
Darth Vador
Darth Vador - avatar
- 3
indentation
9th Sep 2016, 8:16 AM
proRam
proRam - avatar
- 4
Hey guys it's proRam@LOGO Industries what about starting a python developrs group Drop in ur whatsapp nos. of fb ids
9th Sep 2016, 8:18 AM
proRam
proRam - avatar