JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Solution Update Variables
Share
Explore
Gallery
Solution Update Variables
Solution Update Variables
Solution
The Task
Python Starter Code
Code Clips
Solution
At the right hand side is the
the task, starter code and code clips
that pupils got.
Below is a link to the solution. You can right click
open on replit
to demo the answer to pupils and talk through the code.
Incase it doesn’t load above here is the link
https://replit.com/@STACSSupport/Teachers-Update-Variables?v=1
# assign (store) a value
passCode
=
123456
# assign (store) a value
password
=
'ZYXW0987'
print
(
'\n'
)
# display blank line
# display the value stored in the variable
print
(
'The temporary passcode is '
+
str
(
passCode
)
)
# enter and store a new value in the variable (assign)
passCode
=
int
(
input
(
'Please enter a new pass code: '
)
)
# display the value stored in the variable
print
(
'Your new passcode is '
+
str
(
passCode
)
)
print
(
'\n'
)
# display blank line
# display the updated value stored in the variable
print
(
'Your temporary password is '
+
password
)
# enter and store a new value in the variable (assign)
password
=
input
(
'Enter a new secure password: '
)
# Display the new value stored for the pasword
print
(
'Your new password is '
+
str
(
password
)
)
print
(
'\n'
)
# display blank line
Gallery
Share
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.