MODULE 1
READING:
TASKS:
Install Python on your device. Read the #python-installation channel on the Discord server.
Do P-Set 1
P-Set 1
Remember to document your code well. Report all results in a LaTeX-rendered PDF document. Submit your .py file and your .PDF file in a single compressed folder (.7z, .zip, or .rar).
TASK:
John List wishes to better understand South Side crime. To do so, we wish to conduct interviews with South Side residents and understand the demographics of South Side Chicago before conducting a field experiment.
What are potential data that we would wish to collect from each individual? Propose 10 variables that we may want to collect in a survey, including, at the very least, these 5, along with a very short explanation of why it could be of interest.
Age, in months
Name
Income
Whether they have been a victim of violent crime in the past year (assume this is always 365 days).
The number of days since they have last witnessed a violent crime
For each variable in Question 1, state what the data type of variable should be.
Suppose researchers in the field will run a Python script to store survey data when talking to South Side residents. Create all 10 variables in Question 1 based on user input (Chapter 2.8).
We define “witnessing” a violent crime to include events where the resident is a victim of the violent crime in question. After collecting survey data from the resident, the script should tell the researcher whether the resident witnessed a violent crime in the past year and compare it to whether the resident was a victim of violent crime in the past year.
Suppose we conduct an experiment to see whether wealth transfers to residents deter crime. The script should at this point prompt the researcher to input the randomized wealth transfer to the resident (0 means the resident does not receive any transfer). For the purposes of our research, we count this as income. Add this wealth transfer to the income variable. Print the income variable so that the researcher can verify that it is correct.
Create a new variable, age_in_years, based on age in an appropriate manner. Ensure that this is a whole number, with all decimal places truncated. Print this new variable so that the researcher can verify that it is correct.
We now wish to thank the resident for assisting us in our research. Print a string, with their name included, of a farewell greeting that the researcher can repeat to thank the resident.