# Using PyCharm and submitting assignments
The goal of this assignment is to familiarize you with the core concepts of
programming languages---values, types, and operations---and to introduce you
to the basic functionality of the Python programming language.
In Part 1, you will explore the concepts of *value* and *type*. In Part 2, you
will implement an interactive program using conditionals.
| Part | Section |
|---------------|-----------------------------------------------|
| 1 (in-lab) | [Description](#part1) |
| 1 (in-lab) | [Check-in Instructions](#checkin) |
| 2 (lab/home) | [Description](#part2) |
| 2 (lab/home) | [Submission Instructions](#submission) |
## Part 1: Values, Types, and Operations
After starting PyCharm you can can accept the defaults and, eventually,
should get to a screen that invites you to select ***Create New Project***.
Go ahead and create the project, making sure that the location of the
project is a new sub-folder (e.g. `Introduction`) in the
`CSCI051p-Workspace` you created on your Desktop last week.
Download the [starter file](Introduction_part1.py)
for part one, `Introduction_part1.py`, and copy it
into the (recently created) `CSCI051p-Workspace/Introduction` folder. Then ask
PyCharm to rescan that folder by clicking the triangle next to that folder (on
the left-side list) to close and re-open it. The newly added
`Introduction_part1.py` should now be visible. If you double-click it (in the
left-side list), that file should appear in the main editing window.
### 1.1 Values and Types
Observe that the starter file contains a simple, one-line program:
```
print("Hello world!")
```
What happens when you run this program?
Recall that the easiest way to run a
program that you are editing is to place the cursor in the file editing window
and right-click. One of the options will be `Run` (and the name of the
currently selected file); select this option. You can also selection option
`Run` from the `Run` menu.
What happens if you change that line to the following?
```
print('Hello world!')
```
How about this?
```
print(Hello world!)
```
There is a way to find out the type of a value in Python. Try putting the
following three lines of code in your Python file and compare it to what
happend before.
```
print(type("Hello world!"))
print(type('Hello world!'))
print(type(Hello world!))
```
Given their types, what might you hypothesize about the print function?
You will not need to demonstrate any code for this part; you will just need to
explain your hypothesis during your lab check-in. You probably want to comment
out any print statements remaining from this part before proceeding.
### 1.2 Expressions and Types
Now let's explore the ideas of value and type a bit more. Determine what the
following expressions evaluate to (value and type):
1. `3/2`
2. `3.0/1`
3. `"3/2"`
4. `"3"/2`
5. `3*2`
6. `3.0*2`
7. `"3*2"`
8. `"3"*2`
How would you explain your results? You might want to play around a bit more
with other expressions to make sure your explanation generalizes.
You will not need to demonstrate any code for this part; you will just need to
describe the explanation you came up with during your lab check-in.
You probably want to comment out any print statements remaining from this part
before proceeding.
### 1.3 Using Expressions
Consider the following word problems:
1. Last night Cecil went to sleep at 11:00pm. This morning he woke up at
8:27am. How many seconds of sleep did he get?
2. What is the ratio of the amount of sleep that Cecil got last night to the
amount of sleep that you got last night?
Write a program in your file `Introduction_part1.py` that solves these two
problems and prints out each of the solutions.
### Checking In
Call over an instructor or TA to discuss your explanations for 1.1 and 1.2 and
to check your code from 1.3. If you have been successful thus far, they will
award your points for Part 1.
This must be completed before leaving the lab.
After that you should start working on Part 2.
## Part 2: An Interactive Program
For this part, you will write a program which interacts with the user.
Download the [starter file](Introduction.py) for part two, `Introduction.py`,
and copy it
into your `CSCI051p-Workspace/Introduction` folder. Then ask PyCharm to rescan
that folder by clicking the triangle next to that folder (on
the left-side list) to close and re-open it. The newly added
`Introduction.py` should now be visible. If you double-click it (in the
left-side list), that file should appear in the main editing window.
Observe that this file currently contains a multi-line comment at the top. Edit
this comment to include your name, and then write an interactive program in
this file.
### 2.1 Specification
For full credit, your program must do each of the following:
* Ask the user for at least two piecfes of information about themselves
* Display some response that both says something about the program and relates
it in some meaningful way to the information the user gave you.
In addition, the way in which your code accomplishes the above must satisfy the
following requirements:
* Use the `input()` funciton
* Use (at least) one variable
* Use (at least) two of the operators `+,-,/,*`
* Operate (at least) once on something of type `int` or `float`
* Operate (at least) once on something of type `str`
* Use (at least) two conditional expressions (i.e., `if` statements)
### 2.2 Example
The previous section outlines the requirements. You're strongly encouraged to
exercise your creativity in satisfying them! The following is one example of a
program that satisfies the (minimum) requirements. (Yes, you'll have to take
our word for it that the underlying code satisifes the implementation
requirements... note the distinction between *what* something is doing and
*how* it does it!)
```
*******************************************************************************
What is your name?
Cecil
Hi Cecil!
It is nice to meet you. My name is Eleanor Birrell. I am a professor at Pomona
College. It is my second year here, and I think I have an amazingly wonderful
(although occasionally stressful) job.
Pick a number
60
I am fond of the number 13, which is 47 less than 60.
I also like tea, hiking, and quiet reading time. Do you like tea?
Yes
Great! I keep a selection of teas in my office. You are welcome to come by
sometime if you would like a cup.
Bye!
*******************************************************************************
```
### 2.3 Commenting your code
Comment your code appropriately, following the
[Python Coding Style Guidelines](../../python_style.html).
At a minimum, your program should contain:
* The block comment at the top, suitably modified for you. Date should be the
date you completed the assignment.
* At least one high-quality comment (and more if you think a reader would find
it helpful) in your code.
## Part 3: Feedback
Create a file named `feedback.txt` that answers the usual questions:
1. How long did you spend on this assignment?
2. Any comments or feedback? Things you found interesting? Things you found
challenging? Things you found boring?
## Submission
For this lab you are required to submit two files:
- `Introduction.py` your updated and commented version of the supplied starter file.
- `feedback.txt` a text file containing your feedback for this assignment.
These should be submitted using
[submit.cs.pomona.edu](http://submit.cs.pomona.edu)
as described in the general [submission instructions](../../submit.html).
Remember that you *must* submit both files in the same submission. You can do
this by selecting both files (e.g., holding down shift and then clicking on
both files) and uploading them at the same time. Only your most recent
submission will be graded
Note that you will lose points if your submitted files are incorrectly named or
if they are submitted separately. Please double check that you got this right.
## Note on Academic Honesty
You are encouraged to demonstrate your working code to each other.
You are even encouraged to be inspired by what other people have done
in order to make your own program even more amazing. However, if you
do so, you *must* acknowledge them (both name and what exact
idea you used from them) in that multi-line comment at the top of your
program. Note that you also must acknowledge any other sources that
you are inspired by (e.g. a submission based on HAL 9000 from Arthur
C. Clarke's novel `2001: A Space Odyssey`). From experience,
we know that dealing with academic honesty cases is extremely
stressful for everyone involved. Please don't let it come to that.
## Grade Point Allocations
| Part | Feature | Value |
|-----------|-------------------------------------------|-----|
| Lab | Check-in of Part 1 | 3 |
| | | |
| Execution | asks user for at least two pieces of information | 2 |
| Execution | response says something about the programmmer | 2 |
| Execution | response (meaningfully) related to the information from user | 4 |
| Execution | no errors | 2 |
| | | |
| Style | Correctly named files | 2 |
| Style | Files submitted together | 1 |
| Style | file-level block comment | 1 |
| Style | single-line comments | 2 |
| Style | at least one variable | 1 |
| Style | at least two operators | 2 |
| Style | operating on a string | 1 |
| Style | operating on a numeric type | 1 |
| Style | at least two conditionals | 4 |
| | | |
| Feedback | Completed feedback file submitted | 2 |