doubt

154 views
Skip to first unread message

elias p.kuriakose

unread,
Oct 5, 2020, 4:04:01 AM10/5/20
to Discussion forum for Mathematics for Data Science I
Assignment 3 qn 3...is there 6  integers in it??
square root 49,7,-35,22,1729,-20000

Ansh Bhardwaj

unread,
Oct 5, 2020, 6:02:04 AM10/5/20
to Discussion forum for Mathematics for Data Science I, elia...@gmail.com
Please refrain from asking duplicate doubts. First go through the forum and if you don’t find a doubt similar to yours then only you should ask questions. If you see carefully, then 7 is already in the list of integers which is square root of 49 hence the answer will be 5 and not 6
Message has been deleted
Message has been deleted

Christopher Raphael

unread,
Oct 6, 2020, 3:25:35 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:33 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 13:34:01 UTC+5:30, elias p.kuriakose wrote:

Venkatesan Shesha Srikanth

unread,
Oct 6, 2020, 7:28:07 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