Week 3 Content

398 views
Skip to first unread message

madhur sharma

unread,
Nov 1, 2020, 9:24:47 PM11/1/20
to Discussion forum for Computational Thinking
Respected Madam/Sir
i am having a doubt in question no 5 of activity question 8 
how it come to true true true i mean how the 3 cards lie in top 3 positions 
kindly explain me please i am getting confuse in it.
with regards
madhur sharma

Computational Thinking Support 2

unread,
Nov 2, 2020, 2:26:54 AM11/2/20
to Discussion forum for Computational Thinking, madhursh...@gmail.com
Hi,
Can u try to solve using the attached pseudocode explained in the lecture.
I am trying to explain for one case.
Case I: SubjectTopper(X, 0, 0, 0)
So in this case you are inputting marks of card X, MMark = 0, PMark = 0 and CMark = 0. Now consider if condition in pseudocde:
if (Card.Maths  >= MMark or Card.Physics >= PMark or Card.Chemistry >= CMark). In this case to go inside if block anyone of the statement should be correct.
It will be true if one of the statement will become correct. Now let us consider the worst case that Card X has 0 marks in all subjects. So when you will compare Card.Maths >= 0 and other two statement will give true condition. Therefore code will go inside if block and return True.

Now try to solve other two cases by yourself. If you have still doubt please write us again.

Regards,
Deepak
IITM Online Degree Team
Screenshot from 2020-11-02 12-40-42.png

Srinath Sai

unread,
Nov 2, 2020, 3:01:26 PM11/2/20
to Discussion forum for Computational Thinking, ct-su...@onlinedegree.iitm.ac.in, madhursh...@gmail.com

Are these two functions, namely, 
1) 'OR' function
2) 'greater than or equal to comparison with 0 marks of MMark, PMark and Cmark' 

 used only to make sure that each and every card in the Pile enters the 'If block' of the SubjectTopper procedure, including a card with an unlikely score of zero in all three subjects, and no card gets missed out while calling this procedure.
Reply all
Reply to author
Forward
0 new messages