Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list - 2 questions:
#3
(Jul-31-2021, 11:36 AM)ndc85430 Wrote:
(Jul-31-2021, 11:31 AM)ben1122 Wrote: I dont get it, no matter what I try, I wont get anything other than the []...
I dont need a solution, What I need is a tip, what to change here ( only one thing, ill try to understand alone the rest ).

On line 9, you create a variable called my_list to which you assign an empty list. Then, you check its value and then you slice it and return. That list is empty, so of course you return an empty list.

You shouldn't use the same name for that variable as you're using for the function parameter. Choose a different one.

hmm, ill try and update.
and for the second question ( not related to you, just adding, cus I found one of the tries I did, which didnt work ):
def shift_left(my_list):
    """
    This function moves the list with 3 numbers one step to the left.
    If it was 0 1 2, then it will be 1, 2, 0.
    :param my_list: The numbers of the list I will choose.
    :type my_list: str, int, float
    :rtype
    :return: the result of the list with one step left.
    """
    my_list = [p1, p2, p3]
    new_list = []
    new_list[0] = my_list[1]
    new_list[1] = my_list[2]
    new_list[2] = my_list[0]
    return new_list

modified_list = shift_left(my_list=[0, 1, 2])
print(modified_list)
just added so ill have one of the tries, but the one that half-worked me, couldnt find it.

but about what you said to the first question, ill try it now.
Reply


Messages In This Thread
list - 2 questions: - by ben1122 - Jul-31-2021, 11:33 AM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 11:36 AM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 11:41 AM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 11:43 AM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 11:46 AM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 11:48 AM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 11:44 AM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 11:45 AM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 11:47 AM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 12:05 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:08 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 12:10 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:16 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:17 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:17 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:19 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 12:23 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:31 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 12:37 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:39 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:37 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:40 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:49 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 12:50 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 12:53 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 01:00 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 01:03 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 01:24 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 01:32 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 01:36 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 02:03 PM
RE: list - 2 questions: - by ndc85430 - Jul-31-2021, 02:05 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 02:24 PM
RE: list - 2 questions: - by deanhystad - Jul-31-2021, 03:11 PM
RE: list - 2 questions: - by ben1122 - Jul-31-2021, 03:31 PM
RE: list - 2 questions: - by deanhystad - Jul-31-2021, 05:06 PM
RE: list - 2 questions: - by Pedroski55 - Jul-31-2021, 11:18 PM
RE: list - 2 questions: - by Pedroski55 - Jul-31-2021, 11:48 PM
RE: list - 2 questions: - by Pedroski55 - Aug-01-2021, 03:06 AM
RE: list - 2 questions: - by snippsat - Aug-01-2021, 04:27 PM
RE: list - 2 questions: - by naughtyCat - Aug-18-2021, 05:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Discord bot that asks questions and based on response answers or asks more questions absinthium 1 48,863 Nov-25-2017, 06:21 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020