loops - (Python) Stuck on skipping range values for the sum of a randint list -


I need to create a program in Python, which generates ten random numbers 1-100 which is a list In the store. Then a second loop should show the list, then display them also to calculate the amount of strange elements. Whatever I have done so far, any help is greatly appreciated. Random DEF main (): number list = [0] * range for 10 (10): numlist [r] = random.randint (1,100) print (numlist) list_length =

  Lane (number list) print ('number of elements in the list', list_length)   

More specifically, this is the part I got stuck on. I have to add the amount of elements and weird still. I have tried everything around me that has given me only the sum of the total elements. (0, 10, 2) for class in

  category: numlist [x] = numlist print ('sum of strange numbers', sum (numlist)) main ()   

  import random nums = [random.randint (1,100) _ range (10)] (Lambda i: i% 2 =    

You can also type lambda and filter = 0, nums) oddSum = sum (filter (lambda i: i% 2, nums))

or do some quick help

  def There is also (x): return x% 2 == 0 def odd (x): return x% 2 == 1 here That SAM = sum (filter too, nums)) oddSum = sum (filter (isOdd, nums))    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -