Hello,
I am new to the forum and new to Python and maybe i did not post in the right part of the forum.
I have this code:
Any explaination why i cant have the right output is appreciated.
Thank you
I am new to the forum and new to Python and maybe i did not post in the right part of the forum.
I have this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import numpy as np mlist = [ 8 , 7 , 5 , 2 , 1 , 4 , 5 , 6 , 8 ] i = min (mlist) print ( "low" , i) t = mlist.index(i) o = len (mlist) print ( "elements" , o) p = slice ( 0 ,t + 1 ) print ( "slash" , mlist[p]) print (mlist[ - t - 1 :: - 1 ]) add = 1 + 2 + 3 for x in mlist[ - t - 1 :: - 1 ]: if x > = add: break x + = x / / it return 2 , 4 , 10 in the output but should return 1 , 3 , 8 print ( "stop" ,x) |
Thank you
buran write Dec-30-2021, 08:29 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.