Assignment 1 – Two Truths and a Lie

Learning Objective

Write a Python program that creates and uses variables of different types.

Assignment Description

Create variables with information about yourself. Use the print() function to print information to the user.

Steps

  1. In PyCharm (Community Edition), open an existing ITP115 project. If you do not have a project, then create a new project in PyCharm. This project can be anywhere on your computer that is convenient to access such as in your Documents folder or on your Desktop. Follow the instructions in the installation document.
  2. Under the Assignments directory, create a new directory called a1_last_first where last is your last/family name and first is your preferred first name. Use all lowercase letters. If you do not have an Assignments directory, then first create a new directory in PyCharm in your ITP115 project.
  3. In the a1_last_first directory, create a new Python file called assignment1.py.
  4. At the top of the file, put comments in the following format and replace the name,

email, and section with your actual information:


# ITP 115, Fall 2022
# Section: number or nickname
# Assignment 1
# Description:
# Describe what this program does such as:
# This program displays two truths and a lie.

  1. Create the following variables with information about yourself:
    o 5 strings (str): first, last, statement1, statement2, statement3 o 3 Booleans (bool): truth1, truth2, truth3

This content is protected and may not be shared, uploaded, or distributed.

ITP 115 2022-08-21 o 2 integers (int): pets, siblings

  1. The variable named first should hold your preferred first name while the variable named last should hold your last/family name.
  2. The statement1, statement2, and statement3 variables should be three statements about you such that two of them are true and one of them is a lie.
  3. The truth1, truth2, and truth3 variables should be set to True or False depending on if the corresponding statement is a truth or a lie. Two of them should be set to True and one them should be set to False.
  4. The variable named pets should be an integer representing the number of pets you have.
  5. The variable named siblings should be an integer representing the number of sibling you have.

11.Print your full name on one line using one print statement and the two appropriate variables.

12.Print the number of pets and siblings using the appropriate integer variables.

13.Print the three statements using the appropriate string variables.

14.Print messages saying if each statement is true by using the appropriate Boolean variables.

15.Be sure to comment your code. This means that there should be comments throughout your code. Generally, a comment for every section of code explaining what it does. Points will be deducted for not having comments.

16.Test the program. Look at the Sample Output below. Assignments that do not run are subject to 20% penalty.

17.Prepare your submission:
o Find the a1_last_first folder on your computer and compress it. This cannot be

done within PyCharm.

o On Windows, use File Explorer to select the folder. Right click and select the Send to -> Compressed (zipped) folder option. This will create a zip file.

o On Mac OS, use Finder to select the folder. Right click and select the Compress “FolderName” option. This will create a zip file.

18.Upload the zip file to your Blackboard section:

o On Blackboard, navigate to the appropriate item.
o Click on the specific item for this assignment.
o Click on the Browse Local Files button and select the file. o Click the Submit button.

Grading

  • §  This assignment is worth 20 points.
  • §  Make sure that you the program runs. Points will be taken off if the graders have to edit the source code to test your program.
  • §  Make sure to submit your assignment correctly as described above. Points will be taken off for improper submission.

Item Points

Creating 5 str variables 5

Create 3 bool variables 3

Create 2 int variables 2

Print using variables 5

Comments, followed instructions, and proper submission 5

Total 20

Sample Output

Full name: Trina Gregory

Number of pets: 2

Number of siblings: 1

Statement 1: I have lived in a country outside of the US. Statement 2: I can juggle.
Statement 3: I have ice skated at Rockefeller Center in NYC.

Statement 1 is False

Statement 2 is True

Statement 3 is True