by CodeChum Admin
Lists are fun to make, but it's even better to add or remove things from it when it's not usable anymore, right? Let's do just that in this problem now!
Instructions:
Input
Two lines containing a string.
fun
Python
Output
A line containing a string.
Python·is·really·fun
# create two variables and accept string values
first = input()
second = input()
# a list containing three string values
L = ["is", "realy", "good"]
# Insert the first inputted string to the end of the list
L.append(first)
# Insert the second inputted string into the beginning of the list
L.insert(0, second)
# Remuce the 4th element of the list (its index is 3)
L.pop(3)
# Print out the remaining contents on the list, using loop
for s in L:
print(s, end=' ')
print()
Comments
Leave a comment