Please help me with these python Also, include a screenshot of the code if possi
ID: 3597860 • Letter: P
Question
Please help me with these python
Also, include a screenshot of the code if possible
Part 1
Part 2:
Questlon 1:1 Reset to Starter Code Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit l'exit' should NOT be added to the list). These values entered by the user are added to a list we call 'initial_list. Then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. Finally, inside main(). print out all of the values in the new list For example: Input Enter value to be added to list: a Enter value to be added to list:b Enter value to be added to list: Enter value to be added to list: exit Output: Note how 'exit is NOT added to the list. Also, your program needs to be able to handle any variation of 'exit' such as 'Exit, EXIT etc. and treat them all as 'exitExplanation / Answer
def makeThree(initial_list):
new_list = initial_list*3
return new_list
initial_list = []
while True:
item = input("Enter value to be added to list: ")
item = item.rstrip()
if item.lower() == "exit":
break
initial_list.append(item)
new_list = makeThree(initial_list)
for item in new_list:
print(item)
# copy pastable code: https://paste.ee/p/jsTJc
def return_list(string):
parts = []
if "," in string or " " in string:
if "," in string:
parts = string.split(",")
else:
parts = string.split()
return parts
return string
def main():
the_string = input("Enter the string: ")
result = return_list(the_string)
print(result)
main()
# copy pastable codelink: https://paste.ee/p/bgwTg
Did first two (even though chegg policy say do first one on multiple question)
Please note these are not parts of same question these are diferent question. Parts are something which is relatable.
If these are considered as parts then anyone can post 4 unreleated question in one question labelling them as 4 parts.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.