Python Forum
Check if all the numbers are higher than five and if not...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if all the numbers are higher than five and if not...
#4
(Jan-11-2021, 11:00 AM)Serafim Wrote: 123456 numbersList = [6, 3, 9, 36, 96, 1, 18, 99, 8, 5, 12, 2]invalid = [x for x in numbersList if x < 5]if invalid:    print('You have som invalid numbers:', invalid)else:    print('You are good to go.')
Great! Thank you.
Reply


Messages In This Thread
RE: Check if all the numbers are higher than five and if not... - by banidjamali - Jan-11-2021, 11:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Higher or lower game SEWII 17 4,106 May-28-2023, 11:59 AM
Last Post: jefsummers
  Random Generator: From Word to Numbers, from Numbers to n possibles Words Yamiyozx 2 1,468 Jan-02-2023, 05:08 PM
Last Post: deanhystad
  Convert list of numbers to string of numbers kam_uk 5 3,061 Nov-21-2020, 03:10 PM
Last Post: deanhystad
  Regular Expressions in Files (find all phone numbers and credit card numbers) Amirsalar 2 4,138 Dec-05-2017, 09:48 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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