JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Solution Tyre Pressure Update
Share
Explore
Gallery
Solution Tyre Pressure Update
Solution Tyre Pressure Update
Solution
The Task
Python Starter Code
Code Clips
Solution
Solution
solution after update
# Tyre Pressure Update
# --------------------
# blank line
print
(
'\n'
)
# INPUT
# read value, convert data type, assign to a variable
tyrePressure
=
int
(
input
(
'Please enter the tyre pressure: '
)
)
# PROCESS and OUTPUT
# condition: 'the tyre pressure is 7' is it a true statement
if
tyrePressure
!=
7
:
# conditional message output
print
(
'Warning! Your tyre pressure needs attention! '
)
else
:
# conditional message output
print
(
'OK, the tyre pressure is correct'
)
#end if
solution before update
# Tyre Pressure Update
# --------------------
# blank line
print
(
'\n'
)
# INPUT
# read value, convert data type, assign to a variable
tyrePressure
=
int
(
input
(
'Please enter the tyre pressure: '
)
)
# PROCESS and OUTPUT
# condition: 'the tyre pressure is 7' is it a true statement
if
tyrePressure
==
7
:
# conditional message output
print
(
'OK, the tyre pressure is correct'
)
else
:
# conditional message output
print
(
'Warning! Your tyre pressure needs attention! '
)
#end if
original tyre pressure version (for reference)
# Tyre Pressure Update
# --------------------
# blank line
print
(
'\n'
)
# INPUT
# read value, convert data type, assign to a variable
tyrePressure
=
int
(
input
(
'Please enter the tyre pressure: '
)
)
# PROCESS and OUTPUT
# condition: 'the tyre pressure is 7' is it a true statement
if
tyrePressure
==
7
:
# conditional message output
print
(
'OK, the tyre pressure is correct'
)
#end if
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.