Podcast
Questions and Answers
What does the pass
statement do in a for
loop during iteration?
What does the pass
statement do in a for
loop during iteration?
Which statement correctly calculates the total amount after reducing a price by 25%?
Which statement correctly calculates the total amount after reducing a price by 25%?
In sorting a list of people by age, what should be done if two people share the same age?
In sorting a list of people by age, what should be done if two people share the same age?
What is the effect of the continue
statement in a loop that iterates through a list of strings?
What is the effect of the continue
statement in a loop that iterates through a list of strings?
Signup and view all the answers
What data should be collected for each person in the directory program?
What data should be collected for each person in the directory program?
Signup and view all the answers
Flashcards
Python for
loop with pass
Python for
loop with pass
A Python loop that executes a block of code for each item in a sequence. The pass
statement does nothing; it's used as a placeholder when no action is required.
Python continue
statement
Python continue
statement
A Python statement used within a loop to skip the rest of the current iteration and proceed to the next iteration.
Restaurant Program calculation
Restaurant Program calculation
Determine total amount after reducing 25% from the sum of entered item prices.
Sorting people by age
Sorting people by age
Signup and view all the flashcards
User-input data for people's details
User-input data for people's details
Signup and view all the flashcards
Study Notes
Python Intermediate Exam - October 2023 (CRBS)
- Question Paper Code: QPCB12
- Total Marks: 100
- Total Time: 3 hours
Section A (Marks: 15 x 2 = 30)
- Question 1: Write a program using a
for
loop that prints numbers 1 to 10. Use apass
statement to do nothing for numbers 3 and 7. - Question 2: Create a program that iterates through a list of strings. Use a
continue
statement to skip any string containing the letter 'a'.
Section B (Marks: 30)
- Question 3: Develop a program for a restaurant. Users input item prices. Calculate the total amount after a 25% discount.
Section C (Marks: 40)
- Question 4: Build a directory of information about N people. User input required for N, names, ages, and sex for each person.
- Sort ages in ascending order.
- Names should be printed accordingly, with the youngest first.
- If two people have the same age, print in the input order.
- Constraints: 2 ≤ N ≤ 9
- Sample Input: Number of people, followed by name, age, sex for each person. Example:
John, Doe, 25, Male
. - Sample Output: Sorted names by age, followed by age and sex in parenthesis. Output should look similar to
Bob Brown (20, Male)
.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge with this Intermediate Python exam focused on loops, list iteration, and user input handling. It covers topics such as using control statements and organizing data structures efficiently. Perfect for students looking to assess their understanding of Python concepts.