Today continues on variables and discusses the various operators available to you. We also introduce you to the concept of calling functions in order to run other code.
Read Chapter 2 of your 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?")
Copy the above into a test.py program in VSCode and give it a run!
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 * ?