Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Homework Problem
#2
Hi, Chris!

I'm not sure that I have understood you correctly, but
raising an exception is quite simple in Python, e.g.

def suggest(product_idea):
    if len(product_idea) <= 3:
        raise ValueError('The string has too low length (# of chars should be > 3). ')
    #  do some stuff if needed
    return product_idea + "etc... "
Reply


Messages In This Thread
Homework Problem - by csascott - Oct-27-2018, 04:21 AM
RE: Homework Problem - by scidam - Oct-27-2018, 04:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with a formula 1 kind of homework claroque 2 1,447 Jun-20-2023, 09:58 PM
Last Post: claroque
  Bakery Problem.. Can you Help My Homework Cemvrs 1 2,392 Jan-14-2022, 05:47 PM
Last Post: Yoriz
  Need help with a homework problem on logical operators voodoo 3 4,614 Jun-28-2019, 03:45 PM
Last Post: jefsummers
  Homework Problem Travisbulls34 1 2,970 Sep-11-2018, 04:04 PM
Last Post: ichabod801
  Help with homework problem - iterating a function midnitetots12 4 3,532 Feb-21-2018, 10:51 PM
Last Post: nilamo
  Problem with a homework Samuelcu 2 2,857 Feb-03-2018, 01:39 PM
Last Post: Samuelcu
  Homework problem Dem_Prorammer 1 3,818 May-20-2017, 07:49 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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