0
How can I sort alphabetically my program
11 Respostas
+ 1
ok thanks all
+ 1
okay thanks
0
This code should help you understand sorting alphabetically.
https://code.sololearn.com/W56fsiEFpidN/?ref=app
0
what is the output of this code
arr=[1,2,3,4,5,6,7]
print(arr[2:5][1:3])
can someone help understand the code please
0
You need to use another print statement to perform two slices on the array look in the code below:
https://code.sololearn.com/c9o5iKqF2oi6/?ref=app
You can also Google Python array index slicing or go to the Python documentation and lookup array index slicing to find out all about arrays and slicing in Python.
Btw, Good luck learning Python its a great language to start learning with.
0
If you go to that code I posted and play around with it that may help you.
But the reason why the first print statement outputs 3 4 5 is because the array goes to 2 and then after the two it cuts a slice and then it goes to 5 and after 5 it cuts another slice.
And takes that section of the array out and returns it.
The second print statement does the same thing at 1 and 3.
After 1 it takes a slice and after three it takes a slice.
And it takes that section between the slices out and returns that.
0
Oh, sorry I swear I thought I saw a post that asked if I could explain.
But its gone . Well, maybe it will help anyway.
0
đ
0
Sorry that code was outputting 3,4,6 on the first print statement
because I forgot to put a 5 in the array but I fixed it so its outputting 3,4,5 now.
0
Thats what happens when you get in a hurry and don't check to see if the output is what you expected