0

idk what i am doing wrong

#This is just a greeting
print("Hello Welcome to ACME GRocery Store ")
#input to get the weight of packages
#Example 10, 20, 38, 49, 18, 29, 10, 39
weight= input("Please enter the weight's of all packages with commas in between: ").split(",")
weight.sort()
small = range(0, 5) from weight
medium = range(6, 10) from weight
large = range (11, 25) from weight
extra_large = range(26, 9999999999) from weight
print ("Amount of packages submitted = ", len(weight))
print ("Amount of small packages submitted = ", len(small))
print ("Amount of medium packages submitted = ", len(medium))
print ("Amount of large packages submitted = ", len(large))
print ("Amount of extra large packages submitted = ", len(extra_large))`

i am trying to get the diffrent weight and how many times they were mentioned so lets say 2 small

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • Does this answer your question? [Understanding slicing](https://stackoverflow.com/questions/509211/understanding-slicing) – mkrieger1 Mar 18 '23 at 00:14
  • Please clarify what you are trying to do. – Unmitigated Mar 18 '23 at 00:21
  • 1
    You seem to be inventing your own syntax, then being surprised when it doesn't word. For example, `range(0, 5) from weight` isn't Python. The `from` keyword is used by import statements, e.g. `from math import sqrt`. It's not going to magically do something else you have in mind just because you'd like it to. Try to learn the language as it is, not as you wish it were. – Tom Karzes Mar 18 '23 at 00:22
  • 1
    You could try replacing `small = range(0, 5) from weight` with `small = sum([0<=w<=5 for w in weights])` – Swifty Mar 18 '23 at 00:55

0 Answers0