JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Solution Debug 6.3. Oddly Even
Share
Explore
Gallery
Solution Debug 6.3. Oddly Even
Solution Debug 6.3. Oddly Even
Solution
The Task
Python Starter Code
CodeClips
Solution
Solution
solution
print
(
'\n\n'
)
# display blank line (2)
# get the value to stop at from the user
limit
=
int
(
input
(
'What number do you want to go up to? : '
)
)
print
(
'\n\n'
)
# display blank line (2)
# repeat loop up to the limit, count from 0
for
i
in
range
(
0
,
limit
,
1
)
:
# set number to i + 1
number
=
i
+
1
;
# prints out if number is odd or even, uses remainder 0 or 1
if
number
==
(
(
number
//
2
)
*
2
)
:
print
(
str
(
number
)
+
' is even'
)
else
:
print
(
str
(
number
)
+
' is odd'
)
print
(
'\n\n'
)
# display blank line (2)
original
print
(
'\n\n'
)
# display blank line (2)
# get the value to stop at from the user
limit
=
int
(
input
(
'What number do you want to go up to? : '
)
)
print
(
'\n\n'
)
# display blank line (2)
# repeat loop up to the limit, count from 0
for
i
in
range
(
1
,
limit
,
1
)
:
# set number to i + 1
number
=
i
+
limit
;
# prints out if number is odd or even, uses remainder 0 or 1
if
number
==
(
(
number
//
2
)
*
2
)
:
print
(
str
(
number
)
+
' is odd'
)
else
:
print
(
str
(
number
)
+
' is odd'
)
print
(
'\n\n'
)
# display blank line (2)
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.