Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:16:24+00:00 2026-06-09T00:16:24+00:00

I am not sure why I am getting this error. I have read and

  • 0

I am not sure why I am getting this error. I have read and tried different things, but it is not working.

def product():

    y, x= raw_input('Please enter two numbers: ')
    times = float(x) * int(y)
    print 'product is', times
product()

What am I doing wrong? Thank you so much

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:16:25+00:00Added an answer on June 9, 2026 at 12:16 am

    raw_input returns a single string. to unpack arguments as you’re doing, it would need to return 2 things.

    You could do something like this:

    y, x = raw_input('Please enter two numbers (separated by whitespace): ').split(None,1)
    

    Note that this is still a little fragile because the user could input a string like “2 1 3”. The unpacking would work without an exception, but it would choke when trying to convert “1 3” to an integer. The most robust way to do these things is via a try/except block. Here’s how I would do it.

    while True: #try to get 2 numbers forever.
       try:
          y, x = raw_input("2 numbers please (integer, float): ").split()
          y = int(y)
          x = float(x)
          break  #got 2 numbers, we can stop trying and do something useful with them.
       except ValueError:
          print "Oops, that wasn't an integer followed by a float.  Try again"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not exactly sure how to properly debug this but have tried a few
Hello not sure why Im getting this error. Basically I get it in these
Not sure why I'm getting this error and can't figure it out? The cycle
I'm looping my object data but am getting this undefined value. Not sure why
Ok I'm working on getting better with python, so I'm not sure this is
not sure what I'm missing here, but i keep getting the error. SQLSTATE[HY093]: Invalid
I am getting this error in all of my classes but I am not
I am not sure why I'm getting this error: $ brew install mongodb ==>
I keep getting this RuntimeError which I'm not sure how to fix. Here's what
I am getting the above error and I'm not sure how to fix it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.