Scientific Computing
i = 2 + 3
print(i)
i = i + 7
print("i = ", i)
n
be after the following Python instructions are executed?
j = 5
k = 10
n = j*k
n = n+1
int(3.2)
What happens? Try running the same command a few more times, each time replacing the 3.2
by some other number. What do you think int
does in Python?
float(7)
What happens? Try running the same command a few more times, each time replacing the 7
by some other number. What do you think float
does in Python?
Compute one third of 45.
Compute the sum of 8, 9, and 10.
variables.py
saved to the cs100/ch1
folder you created on the desktop.i = 2 + 3
print(i)
i = i + 7
print("i = ", i)
p
; then, print out the value of p
with a message similar to “p is 20” (just like you did with the variable i
).x
. Print the result as “The power is: ___” , where your answer fills in the blank.avg
; then, display it with a message similar to “The average of these numbers is 19.25”.pi
with the value 3.14159
. Use it to compute the area of a circle with radius 3, and print out the result.Submit your variables.py
file to Activity 3 on Moodle. Make sure it runs without errors!