Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

‭Grade 8 Computer Science Assessment:‬

‭Introduction to If Statements in Python‬

‭Instructions:‬
‭●‬ ‭This assessment contains a series of programming problems and written‬
‭response questions.‬
‭●‬ ‭Write Python code to solve each programming problem using only one if‬
‭statement. Provide a screenshot of your code and possible output below‬
‭each programming question.‬
‭●‬ ‭For the written response questions, write your answer in the space‬
‭provided.‬

‭Programming Problems:‬
‭●‬ ‭Problem 1: Odd or Even?‬
‭Write a Python program that takes an integer input from the user and‬
‭prints whether the number is odd or even.‬

‭●‬ ‭Problem 2: Maximum of Two Numbers‬


‭Write a Python program that takes two integer inputs from the user and‬
‭prints the maximum of the two numbers.‬

‭●‬ ‭Problem 3: Leap Year Checker‬


‭Write a Python program that takes a year input from the user and‬
‭determines whether the year is a leap year or not.‬
‭Written Response Questions:‬
‭●‬ ‭What is the purpose of an if statement in Python?‬
‭Your Answer:‬‭The purpose of a “if” statement is to‬‭control imputed data,‬
‭with the “if” statement you can create controlled responses.‬
‭●‬ ‭Explain Python's difference between "==" and "=".‬
‭Your Answer:‬‭"==" is for checking equality. "=" is‬‭for assignment‬
‭●‬ ‭When would you use an if-else statement instead of just an if statement?‬
‭Your Answer:‬‭If the user can input an incorrect response,‬‭or if the user is‬
‭being asked a question.‬

You might also like