Today continues on variables and discusses the various operators available to you. We also introduce how to call functions in order to run other code.
If you procrastinated, make sure to read Chapter 2 for real in the online textbook.
We will discuss and learn about:
print("Enter a time hh,mm,ss")
hours = input() # Does input() require an argument?
mins = input()
seconds = input()
total = 3600*int(hours) + 60*int(mins) + int(seconds)
print("Elapsed time is", total, "seconds.", end='') # what does end do?
And this one with different operator + usage:
print("Hello let's talk about types!")
x = 5
y = 6
result = x + y
print(result)
x = '5'
y = '6'
result = x + y
print(result)
print("Why did this happen?")
print("Ok let's try again.")
result = int(x) + int(y)
print(result)
print("What do you think?")
Run the above using the online Python interpreter: https://repl.it/languages/Python3
Make sure you understand why the output is how it is. Then play around with it. For instance, what happens if you change the + to a multiply * ?