Using Python with seismic data
Lesson 2: Input and Variables
The program prompts the user for their name, greets them and asks their age,
before calculating a birth year, writing it to screen and then finishing.
The program uses variables, assignment, strings, integers, concatenation,
maths, the print(), input(), int() and str() functions.

Variables
Variables are containers storing data values. They
are created when you assign them a value, name is a string (text) variable, age
is an integer (whole number).
Values are assigned to variables using =.
Collecting data and type casting
The input() function is used to collect user input. It
always returns a string (text) value.
Strings can be concatenated (added together) using the + operator.
To convert a string to an integer (whole number), use the int() function.
To convert an integer to a string use str().
Mathematical operators
Maths is performed using the mathematical operators.
The value of 2020 - age is assigned to the variable year using =.
*, /, +, -, %, // and ** are used for multiply, divide, add, subtract, modulo,
integer division and exponent.
Exercises
1) Type the program for yourself and run it.
2) Adapt the program so it tells you a joke.
3) Write a program that prompts you for one side of a square and prints out the
area.
4) Write a program that prompts you for the radius of a circle and prints the
area and circumference.
Links
The lesson on Twitter:
https://twitter.com/wmvanstone/status/1251612851288113154
Download the code: https://github.com/wmvanstone/LearnPythonForObspy
The obspy tutorial: https://docs.obspy.org/tutorial/
Lesson 1: python01.html
Lesson 3: python03.html