Answer any questions (bold) as comments in your program like this:
# This is a comment to answer a question.
When you complete the assignment upload lab03.py to Moodle!
File
-> New
File
->
Save
sum = 2+ 3
print(sum)
print('The sum is: ' + sum)
print('The sum is: ' + str(sum))
str()
function does?
j = 5
k = 10
n = j * k
n = n + 1
n
will be?
n
and verify your guess.
money = 754.45
money += 10
print(money)
+
(-, *, /, //, %)? Why might this kind of statement be useful?
x = 5 * 12 + 6 / 8 - 4 ** 2
print(x)
first_word = "computer"
second_word = "science"
print(first_word + second_word)
print(first_word * 2)
If you finish early, here are some things you can work on (none of these are required for the assignment, but are good practice).
my_text = 'foobar'
print('This works too:', my_text)
print('This works too:', my_text, sep='!')
sep
does?
print('This works too:', my_text, my_text, sep='!')
sep
?
print('This can work also:', end=' ')
print(my_text)
end
does?
print('This can work also:', end=' ', my_text)
print('This can work also:', my_text, end=' ')
import media
picture = media.makeEmptyPicture(300,300, media.blue)
media.show(picture)
media.quit()
picture
and the
media.show()
function
picture.addRect(media.red, 10, 10, 10, 10, True)
True
to
False
do?