From 48a4338dc967ed274a9f965c39f86c5aeec83c5e Mon Sep 17 00:00:00 2001 From: Dhruv Jain <56195235+dhruvjain896@users.noreply.github.com> Date: Sun, 23 Oct 2022 19:25:40 +0530 Subject: [PATCH 1/2] Added one question regarding python list slicing in python-quiz.ts --- src/data/python-quiz.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/data/python-quiz.ts b/src/data/python-quiz.ts index 8c4168fa..6eb4a1b3 100644 --- a/src/data/python-quiz.ts +++ b/src/data/python-quiz.ts @@ -1581,6 +1581,15 @@ const pythonQuiz = [ Explanation: "In Python, math.trunc() will return the truncated integer part of the number. When the number is positive, math.trunc() is similar to the .floor() method. But if the number is negative, math.trunc() is similar to the .ceil() method", Link: "https://docs.python.org/3/library/math.html", }, + { + Question: "In Python, what will be the output of the following code snippet? lst = [10, 20, 30, 40, 50, 60, 70, 80, 90] print(lst[:5:2])?", + Answer: "[10, 30, 50]", + Distractor1: "[10, 30, 50, 70, 90]", + Distractor2: "[70, 90]", + Distractor3: "[10, 20, 30]", + Explanation: "In Python, list slicing syntax is lst[ Initial : End : IndexJump ]. Leaving any argument like Initial, End or IndexJump blank will lead to the use of default values i.e 0 as Initial, length of list as End and 1 as IndexJump.", + Link: "https://python-reference.readthedocs.io/en/latest/docs/brackets/slicing.html", + }, ]; export default pythonQuiz; From 6c1ee3911d619349655383d23d6772f56b86740c Mon Sep 17 00:00:00 2001 From: Dhruv Jain <56195235+dhruvjain896@users.noreply.github.com> Date: Mon, 24 Oct 2022 10:56:40 +0530 Subject: [PATCH 2/2] Updated the changes requested --- src/data/python-quiz.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/python-quiz.ts b/src/data/python-quiz.ts index 6eb4a1b3..834945b1 100644 --- a/src/data/python-quiz.ts +++ b/src/data/python-quiz.ts @@ -1582,12 +1582,12 @@ const pythonQuiz = [ Link: "https://docs.python.org/3/library/math.html", }, { - Question: "In Python, what will be the output of the following code snippet? lst = [10, 20, 30, 40, 50, 60, 70, 80, 90] print(lst[:5:2])?", - Answer: "[10, 30, 50]", + Question: "In Python, what is the output for the following: print([10, 20, 60, 90][:2:])?", + Answer: "[10, 20]", Distractor1: "[10, 30, 50, 70, 90]", Distractor2: "[70, 90]", Distractor3: "[10, 20, 30]", - Explanation: "In Python, list slicing syntax is lst[ Initial : End : IndexJump ]. Leaving any argument like Initial, End or IndexJump blank will lead to the use of default values i.e 0 as Initial, length of list as End and 1 as IndexJump.", + Explanation: "In Python, list slicing syntax is list[start:stop[:step]]. The start, stop and step parameters are all optional and if omitted will refer to the defaults of 0, length of sequence and 1 respectively.", Link: "https://python-reference.readthedocs.io/en/latest/docs/brackets/slicing.html", }, ];