What are the other python commands?

There are so many! We'll see more as we go through the semester. Stay tuned!

I have a question about commands; is there a separate command for square roots or is it the command each time? / Are there other number operations (like %)? **

As we'll see next week, the math library has lots of useful functions, including the sqrt function:

>>>import math
>>>math.sqrt(9)
3

Is there way to shorten the codes of very long equations to make them easier?

You can try breaking your very long line into several commands that you execute one after the other.

>>>print(int(19.3) + 2)
21
>>>x = int(19.3)
>>>x = x + 2
>>>print(x)
21

How to round numbers

There are two ways: int(3.14) and round(3.14) will both return 3.

why cant strings and integers we used interchangeably?

They are different data, so Python (and the computer) know how to do different things with them. If you try <int> * <int> then Python knows how to multiply two integers, but <str> * <str> isn't an operation that Python knows how to do. (And it's not clear what it means, either...)

Is there a factorial command in python?

Yes, it's in the math library. To run it you first have to import math.

>>>import math
>>>math.factorial(3)
6
>>>math.factorial(5)
120

why does taking the sqrt of a negative number ex: (-9) 1/2 spit out a real number in python? **

This is a great question! The answer is that order of operations means that python is doing the parentheses first, then the exponent (negative nine to the power 1), then the division. If you try (-9)**(1/2) then you'll get the square root of negative nine.

Another way would be (-9)**0.5.

Is there a way to refer to the previous line without copying and pasting the whole thing?

Yes! If you are in the Python interpreter and press the up-arrow on your keyboard, you can see the last thing you entered. Press again to see the thing before that, and before that, and before that...