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 8297373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:23:58+00:00 2026-06-08T15:23:58+00:00

I tried to make a short program that works out the famous Drake equation.

  • 0

I tried to make a short program that works out the famous Drake equation. I got it to accept integer inputs, decimal inputs, and fractional inputs. However, I get this error when the program attempts to multiply them (right after I input all necessary values the error happens):

Traceback (most recent call last)
  File "C:/Users/Family/Desktop/Programming/Python Files/1/DrakeEquation1.py", line 24, in <module>
    calc() #cal calc to execute it
  File "C:/Users/Family/Desktop/Programming/Python Files/1/DrakeEquation1.py", line 17, in calc
    calc = r*fp*ne*fl*fi*fc*l
TypeError: can't multiply sequence by non-int of type 'str'

My code is as follows:

def intro():
    print('This program will evaluate the Drake equation with your values')

def calc():
    print('What is the average rate of star formation in the galaxy?')
    r = input()
    print('What fraction the stars have planets?')
    fp = input()
    ne = int(input('What is the average number of life supporting planets (per     star)?'))
    print('What fraction of these panets actually develop life')
    fl = input()
    print('What fraction of them will develop intelligent life')
    fi = input()
    print('What fraction of these civilizations have developed detectable technology?')
    fc = input()
    l = int(input('How long will these civilizations release detectable signals?'))
    calc = r*fp*ne*fl*fi*fc*l

    print('My estimate of the number of detectable civilizations is ' + calc + ' .')


if __name__=="__main__":
    intro() #cal intro to execute it 
    calc() #cal calc to execute it 

What do I need to change in order to fix this problem?

  • 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-08T15:24:01+00:00Added an answer on June 8, 2026 at 3:24 pm

    You need to convert your input values to floats.

    r = float(input())
    

    (Note: in Python versions less than 3, use raw_input instead of input.)

    And so on for the other variables. Otherwise you’re attempting to multiply a string by a string.

    Edit: as others have pointed out, calc additionally cannot be concatenated to the surrounding strings using the + operator. Use string substitution for that:

    print('My estimate of the number of detectable civilizations is %s.' % calc)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I make a program that proxies and transparently modifies TCP/IP traffic? I
I've got some library code that works on a range of .NET runtimes (regular,
Tried to make a little old school ajax (iframe-javascript) script. A bit of mootools
I tried to make an alert popup with A with: var a = \u0041;
I tried to make a layout look like it It looks like kinda button
I tried to make an asynchronous UDP client using boost::asio I get some code
I tried to make a click counter in MySQL, but it dose not seem
I tried to make my textbox type in currency format. I did it, but
I tried to make a new bare git repository but I get this error:
I tried to make admin panel and I am using sessions , but have

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.