How old is Sam?

What does the following python code print out?

1
2
3
4
5
6
7
8
current_year = 2013   
deans_birth_year = 1979   
dean_minus_kelly = 2       
dean = current_year - deans_birth_year    
kelly_minus_sam = 2    
kelly = dean - dean_minus_kelly    
sam = kelly - kelly_minus_sam    
print sam   


The answer is 30.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

32 solutions

Hanna Noay
Dec 22, 2013

c y=2013 d b y=1979 d m k=2 solution: dean=c y - d b y =2013-1979 =34

K m s=2 solution: kelly=dean - d m k =34 - 2 =32

sam=kelly - k m s =32 - 3 =30(answer)

Jaimeline Marcelo
Dec 24, 2013

Current year minus deans birth year= 34. Then dean minus dean minus kelly is 34-2= 32. Then 32-2= 30

34-2=30 You need to improve your elementary maths.

Bilal Zahoor - 7 years, 5 months ago

answer is 30

Ghulam MuStafa - 7 years, 5 months ago

30

manujla manu - 7 years, 3 months ago
Brijesh Pal
Dec 22, 2013

dean = current year - deans birth year dean=2013-1979 dean=34 kelly minus sam = 2 kelly = dean - dean minus kelly kelly=34-2 kelly=32 sam = kelly - kelly minus_sam sam=32-2 sam=30

we are asked to find PRINT SAM.So to find sam it is that kelly-kelly minus sam and kely=dean-dean minus kelly and kelly minus sam=2. so solve in following steps: 1)first find kelly 2)to find kelly first find dean which is current year-deans birth-year solution: dean=2013-1979=34 3)now subtract dean which 34 from dean minus kelly which is 2 solution: 34-2=32 kelly=32 4)now finally find sam 5)sam=kelly-kelly minus sam kelly is 32 and kelly minus sam=2, so answer is as follows solution: 32-2=30 which is sam

I have explained in details so that i could be understandable

Abu Bakar - 7 years, 5 months ago

current year = 2013 deans birth year = 1979 dean minus kelly = 2 dean = current year - deans birth year (2013-1979=34 ; dean=34) kelly minus sam = 2 kelly = dean - dean minus kelly (34-2=32 ; Kelly = 32) sam = kelly - kelly minus sam (32-2 = 30 ; Sam = 30)

print sam ;

Answer: 30

PRATHIK SHETTY - 7 years, 5 months ago

dean=2013-1979=34 kelly=34-2=32 sam=32-2

Jowhr Alee - 7 years, 5 months ago
Bhaskar Das
Jan 6, 2014
  1. dean = current year - deans birth_year [dean = 2013 - 1979 = 34]

  2. kelly = dean - dean minus kelly [34 - 2 = 32]

  3. sam = kelly - kelly minus sam [sam = 32 - 2 = 30 ANS]

Mushfik Rahman
Dec 27, 2013

do it backwards: sam = kelly -kelly minus sam = dean - dean minus kelly - 2 [kelly minus sam = 2] = current year - deans birth year - 2 -2 [dean minus_kelly = 2] = 2013 - 1979 -2 -2 = 30

Pasti Bisa
Dec 23, 2013

dean = 2013 - 1979 --> 34 kelly = 34 - 2 --> 32 sam = 32 - 2
= 30

Budi Utomo
Dec 23, 2013

current year = 2013, deans birth year = 1979, 34 minus kelly = 2, dean = 2013 - 1979 = 34, So kelly = 32 ,kelly minus_sam = 2 ---> 32 - sam = 2 ---> Sam =30 print sam = 30

Amelia Thomas
Nov 13, 2014

Sam and Dean Winchester, by any chance? I just put Sam Winchester's age

Sehaj Taneja
Mar 3, 2014

32-2=30

Sriram Bodavula
Mar 3, 2014

2013-1979=34, 34-2=32, 32-2=30.

Suryatej Thota
Mar 1, 2014

y=2013 d b y=1979 d m k=2 solution: dean=c y - d b y =2013-1979 =34

K m s=2 solution: kelly=dean - d m k =34 - 2 =32

sam=kelly - k m s =32 - 3 =30(answer)

Gururaj Kulkarni
Feb 22, 2014

dean=34 kelly=32 sam=30

Pushpendra Kumar
Feb 21, 2014

current year = 2013 deans birth year = 1979 dean minus kelly = 2 dean = current year - deans birth year=2013-1979=34 kelly minus sam = 2 kelly = dean - dean minus kelly=34-2=32 sam = kelly - kelly minus sam=32-2=30 ANSWE (30)

Jamal Saidulu
Feb 9, 2014

dean=current year-deans birth year dean=2013-1979=34 kelly=dean-dean minus kelly=34-2=32 sam=kelly-kelly minus_sam=32-2=30

current year=2013 dear year=1979 dean -kelly=2 dean=2013-1979=34 kelly=32-2=30 sam=32-2=30 Ans: sam=30

Nitheesh Kethu
Jan 25, 2014

given current year=2013 deans birth year=1979 dean= cy -deansbd=2013-1979=34 dean-kelly=2 34-kelly=2 kelly=34 -2=32 kelly - sam=2 we known kelly =32 therefore sam=kelly-2=32-2=30

Neha Mangla
Jan 21, 2014

dean = 2013 - 1979 = 34 kelly = 34 - 2 = 32 sam = 32 - 2 =30 So 30 is the answer

Zakaria Ameen
Jan 18, 2014

dean= 2013-1979= 34

kelly= ( dean=34) minus (dean minus kelly=2)

kelly= 34-2=32

sam= (kelly=32) minus (kelly minus sam=2) -

sam= 32-2= 30

Sowmy Vivek
Jan 15, 2014

dean=34 kelly=32 by solving hence sam=30 ....soo 30 is ans

Santosh Kumar
Jan 11, 2014

Firstly find the value of dean=34 and then find the value of kelly=32 and then find the value of sam=30 printed value is sam. Hence required ans is 30

Aleem Ahmed
Jan 11, 2014

dean = 2013-1979 dean = 34 dean-kelly = 2 34-kelly = 2 kelly = 32 kelly-sam = 2 32-sam = 2 sam = 30

Pebrudal Zanu
Jan 9, 2014

This program will be print: 2013-1979-2-2=30

This is a simple mathematics with +/- operation which is purely depends on your concentration . Beware of the variable names like dean minus kelly and kelly minus sam .

dean=2013- 1979( current year - deans birth year)=34 kelly=34-2(dean - dean minus kelly)=32 sam =32-2(kelly - kelly minus_sam)=30(bingo)

Jericho Guzman
Jan 6, 2014

sam = ((2013-1979) - 2) - 2 = 30

Valerian Pratama
Jan 4, 2014

First,find out how old Dean is.

2013-1979=34

Then,find out how old Kelly

Dean-Kelly=2

,so

34-x=2

x=34-2 =32

Kelly-Sam=2

=

32-x=2

x=32-2

Sam is 30 years old

sam is 30 year old

Ghulam MuStafa - 7 years, 5 months ago

2013-1979-2-2=30

Sayantan Ghosh - 7 years, 1 month ago

http://www.codeskulptor.org/

Girija Lenka
Jul 23, 2013

[2013-1979]=34 [dean's age] dean-kelly=2 {34-32=2} so 32 is kelly's age 32-30=2 {that is sam's age}

Sam = Kelly - Kelly minus sam = (current year - deans birth_year - 2) -2 = [(2013 - 1979) - 2] -2 = 34 -4 = 30

Joshua Crouch
Jul 22, 2013

Dean's birth year is 1979 making him 34. Kelly is two years younger than him which makes her 32. Sam is 2 years younger than Kelly which makes him 30 years old.

Ali Rahemtulla
Jul 22, 2013

Dean=current year minus birth year= 2013 - 1979= 34 Dean minus Kelly= 2, so 34 - Kelly= 2. Thus Kelly= 34-2= 32 Kelly minus Sam= 2, so 32 - Sam= 2. Thus Sam = 30

Leonardo Cidrão
Jul 21, 2013

Deans age = 34 ---> Kelly age=32 --> Sam age=30

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...