JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Solution Album Upload
Share
Explore
Gallery
Solution Album Upload
Solution Album Upload
Solution
The Task
Array info
Pseudocode
Python Starter Code
Code Clips
Solution
Solution
solution
# Abum Upload
import
time
# prints blank line
print
(
'\n'
)
# GET album name
albumName
=
input
(
'Enter album name: '
)
# GET number of songs
numSongs
=
int
(
input
(
'Enter number of songs: '
)
)
# Declare song title array
songTitle
=
[
None
]
*
numSongs
# REPEAT for number of songs on album
for
i
in
range
(
0
,
len
(
songTitle
)
,
1
)
:
# GET song title
songTitle
[
i
]
=
input
(
'Enter song title : '
)
# END REPEAT
# displays a blank line
print
(
'\n'
)
# display uploading message
print
(
'We are uploading your entry...'
)
# pauses program for 3 seconds
time
.
sleep
(
3
)
# clears the screen
print
(
'\033[H\033[2J'
)
# displays a blank lines
print
(
'\n\n'
)
# DISPLAY album name
print
(
'Album name : '
+
albumName
)
# DISPLAY number of songs
print
(
'Number of songs : '
+
str
(
numSongs
)
)
# displays a blank line
print
(
'\n'
)
# REPEAT for number of songs on album
for
i
in
range
(
0
,
len
(
songTitle
)
,
1
)
:
# DISPLAY the song number and the song title
print
(
str
(
i
+
1
)
+
': '
+
songTitle
[
i
]
)
# END REPEAT
# displays a blank line
print
(
'\n\n'
)
# DISPLAY upload complete message
print
(
'Upload complete'
)
original
# Abum Upload
import
time
# prints blank line
print
(
'\n'
)
# GET album name
# GET number of songs
# Declare song title array
songTitle
=
[
None
]
*
numSongs
# REPEAT for number of songs on album
for
i
in
range
(
0
,
len
(
songTitle
)
,
1
)
:
# GET song title
songTitle
[
i
]
=
input
(
'Enter song title : '
)
# END REPEAT
# displays a blank line
# display uploading message
print
(
'We are uploading your entry...'
)
# pauses program for 3 seconds
time
.
sleep
(
3
)
# clears the screen
print
(
'\033[H\033[2J'
)
# displays a blank lines
print
(
'\n\n'
)
# DISPLAY album name
# DISPLAY number of songs
# displays a blank line
print
(
'\n'
)
# REPEAT for number of songs on album
for
i
in
range
(
0
,
len
(
songTitle
)
,
1
)
:
# DISPLAY the song number and the song title
print
(
str
(
i
+
1
)
+
': '
+
songTitle
[
i
]
)
# END REPEAT
# displays a blank line
# DISPLAY upload complete message
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.