Doubt in activity

175 views
Skip to first unread message

Rishika Singh

unread,
Oct 5, 2020, 5:11:20 AM10/5/20
to Discussion forum for Mathematics for Data Science I
Below is a list of real numbers:
√3,2.53,2.5,e,√49,7,22,π,−35,√6,1729,−20000 

How many integers are there in the given list? 

for this ques the ans given is 5 but root 49 is also an integer isn't it?
so ans should be 6, right?

kashifm...@gmail.com

unread,
Oct 5, 2020, 5:49:06 AM10/5/20
to Discussion forum for Mathematics for Data Science I
Hey, total integers are root 49=7, 22,-35,1729,-20000.
so total only 5

Rishika Singh

unread,
Oct 5, 2020, 5:59:28 AM10/5/20
to Discussion forum for Mathematics for Data Science I, kashifm...@gmail.com
but there's both root 49 and 7 written in ques. So they should be counted separately.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Christopher Raphael

unread,
Oct 6, 2020, 3:26:42 AM10/6/20
to Discussion forum for Mathematics for Data Science I
The unmodified list will have "6 counts" of "integer", since the question asks one to count the number of integers in the list. (did not ask for unique integers' count)

Christopher Raphael

unread,
Oct 6, 2020, 4:14:10 AM10/6/20
to Discussion forum for Mathematics for Data Science I
let listOfReals = [ √3, 2.5, e, √49, 7, 22, pi, -35, √6, 1729, -20000 ];
let numberOfElementsInList = listOfReals.length; //=>length of the array = 11
let integerCount=0;

for(i=0; i<numberOfElementsInList; i++)
 {
  if(listOfReals[i]==INTEGER)
   {
   integerCount++;
   }
 }

Result> integerCount: 6
Because √49=7 and therefore will be counted as an integer.


On Monday, 5 October 2020 14:41:20 UTC+5:30, Rishika Singh wrote:

Venkatesan Shesha Srikanth

unread,
Oct 6, 2020, 7:27:22 AM10/6/20
to Discussion forum for Mathematics for Data Science I
Hi,
    You are right, there are 6 integers in the given list. But now, we have corrected the list. Thank you
Warm regards
srikanth venkatesan
IITM Online degree project
3rd floor, IC&SR building, IIT Madras.
Reply all
Reply to author
Forward
0 new messages