Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added one question regarding python list slicing in python-quiz.ts #533

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/data/python-quiz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 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",
},
];

export default pythonQuiz;