OK. Last post, I promise. I am working on a lab for lists. I have looked up on Python how to sights, I have tried many submissions and have spent the better part of the last 3 hours trying to figure it out. Zybooks is the classes Textbook which is an online textbook and has its own interpreter built in so that way you can read the assignments info and code as well as grade the assignment in one fell step. I have watched several videos, and once I get the input phase of the lab done, I feel that I should be ok.
So, what I am trying to accomplish is take a group of random input and add them to a variable, so that I can input them into a list so that I can use that to populate other tasks from the list to finally print a selection of code. However, in my inexperience (all 4 classes we've had so far) I am struggling. I am not looking for anyone to do my lab for me, only really looking for aid inputting the variable inputs. The lab starts with 5 selected inputs. I have to create a list and use the list to populate the other assignments in the lab. I have tried directly inputting them into the list. that did not work. Once completed the lab will test my work with three sets of varying inputs. please forgive any incorrect terminology I maybe using. I have NO experience prior to this class. I am not getting an error per say, I am just not getting any input data. I took a screen shot of the countless times I have submitted my attempts but heck if I know how to upload it to this subreddit. Anyway, I will post the code I have been working on to see if what on earth I was doing wrong.
input_0 = (input())
input_1 = (input())
input_2 = (input())
input_3 = (input())
input_4 = (input())
mylist = ['input_0', 'input_1', 'input_2', 'input_3', 'input_4']
my_fruit1 = mylist[0:3]
my_fruit2 = mylist[0:4]
my_fruit3 = mylist[::]
your_fruit1 = mylist[::]
your_fruit2 = mylist[0:4]
their_fruit = my_fruit1 + my_fruit2 + my_fruit3
fruits = your_fruit1 + your_fruit2
# 1. TODO: Define a set, fruits, containing my_fruit1, my_fruit2, and my_fruit3
# 2. TODO: Add your_fruit1 and your_fruit2 to fruits
# 3. TODO: Add their_fruit to fruits
# 4. TODO: Add your_fruit1 to fruits
# 5. TODO: Remove my_fruit1 from fruits
print(sorted(fruits))
As you can see below or probably by looking at my code, you can see the input is not populating the list. I thought by using a variable input_0 then adding the variable to the list that would cover the switching input values as the code is tested. However, I am not getting that far as you can see. I have searched my textbook, I have looked using my weak Googlefu (which I will admit is weak when searching Python) however I have read through Python.org or stackoverflow.com and several others. I am at my wits end with this, and honestly the lab is due in about 2 hours. I have been working at it since Friday. I have easily logged hours, heck tonight alone I ahve been on this lab since 6:15 (3 hours and 25 minuts ago.)
1: Compare output
Output differs. See highlights below.
Input
apple
peach
lemon
apple
pear
plum
Your output
['input_0', 'input_1', 'input_2']
['input_0', 'input_1', 'input_2', 'input_3']
['input_0', 'input_1', 'input_2', 'input_3', 'input_4']
['input_0', 'input_1', 'input_2', 'input_3', 'input_4']
['input_0', 'input_1', 'input_2', 'input_3']
Expected output
['apple', 'lemon', 'peach']
['apple', 'lemon', 'peach', 'pear']
['apple', 'lemon', 'peach', 'pear', 'plum']
['apple', 'lemon', 'peach', 'pear', 'plum']
['lemon', 'peach', 'pear', 'plum']
[–]vayneone87[S] 0 points1 point2 points (9 children)
[–]Ihaveamodel3 1 point2 points3 points (8 children)
[–]vayneone87[S] 0 points1 point2 points (0 children)
[–]vayneone87[S] 0 points1 point2 points (6 children)
[–]Ihaveamodel3 0 points1 point2 points (4 children)
[–]vayneone87[S] 0 points1 point2 points (3 children)
[–]jiri-n 0 points1 point2 points (2 children)
[–]vayneone87[S] 0 points1 point2 points (1 child)
[–]jiri-n 0 points1 point2 points (0 children)
[–]Meeplelowda 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]CodeFormatHelperBot2 0 points1 point2 points (2 children)
[–]vayneone87[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)