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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:35:54+00:00 2026-05-29T12:35:54+00:00

I am making a python script that suggests new music to you, but for

  • 0

I am making a python script that suggests new music to you, but for some reason i am getting a lot of errors. Script is not finished, but here it is

#!/usr/bin/env python
print("This is to help you find new bands!")
pop = 0
def indie():
    global indie
    global classic_rock
    global metal
    global pop
    indie = 0
    classic_rock = 0
    metal = 0
    pop = 0
    indie += 3
    classic_rock -= 1
    metal -= 1.5
    pop -= 3
def notindie():
    global indie
    indie += 1
def classicrock():
    global classic_rock
    classic_rock += 2
def notclassicrock():
    global classic_rock
    classic_rock -= 1
def popp():
    global pop
    global indie
    pop += 3
    indie -= 3
def notpop():
    global pop
    global metal
    pop -= 1
    metal += 1
def notmetal():
    global metal
    global pop
    metal -= 3
    pop += 1
def metal():
    global metal
    global pop
    global indie
    global classicrock
    classicrock += 1
    metal += 3
    indie -= 1
    pop -= 4
que = input("Do you consider yourself to be a hipster? (Yes/No) ")
if que == 'yes':
    indie()
if que == 'no':
    notindie()
que2 = input("Do you like the Rolling Stones? (Yes/No) ")
if que2 == 'yes':
    classicrock()
if que2 == 'no':
    notclassicrock()
que3 = input("Do you like Britney Spears? (Yes/No) ")
if que3 == 'yes':
    popp()
if que3 == 'no':
    notpop()
que4 = input("Do you like Metallica? (Yes/No) ")
if que4 == 'no':
    notmetal()
if que4 == 'yes':
    metal()

if i enter yes for do you like metallica, i get the error

File "tastepy.py", line 69, in <module>
    metal()
TypeError: 'float' object is not callable

if i enter in no for the hipster question:

Traceback (most recent call last):
  File "tastepy.py", line 54, in <module>
    notindie()
  File "tastepy.py", line 19, in notindie
    indie += 1
TypeError: unsupported operand type(s) for +=: 'function' and 'int'

I get these although there is no float anything in metal()
anybody know what is going on?

  • 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-05-29T12:35:56+00:00Added an answer on May 29, 2026 at 12:35 pm

    The problem is that you are using the same names for your functions as your variables, and they are clobbering each other. Try using different names, e.g. for functions likes_metal() and for the variable metal_score.

    Also you should declare and initialize your globals at the global level, not within the indie function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a python script that should zip a file and upload it at
I am making a python script that in the case of EXT filesystem, will
In Alex Martelli's response to Making a Python script Object-Oriented , he mentions that
I am still very new to python, but I need to interface with some
I'm making a python script that should run in the background and notify a
I'm making a python script that needs to do 3 things simultaneously. What is
Im making a small python script to upload files on the net. The script
I'm making a script parser in python and I'm a little stuck. I am
I am making a Python gui project that needs to duplicate the look of
I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1.

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.