typeerror

Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> print(name + age) TypeError: can only concatenate str (not "int") to str

Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> print(name + age) TypeError: can only concatenate str (not "int") to str Question: I was writing the above code when I encountered an error can you help me? name = ‘mahbod’ age = 12 print(name + age) Traceback (most recent call last): File "<pyshell#2>", …

Total answers: 1

Error: TypeError: 'list' object is not callable Using turtle graphics

Error: TypeError: 'list' object is not callable Using turtle graphics Question: I am attempting to code space invaders. I am doing some finishing touches however when trying to create three hearts in the top corner to represent lives I have this error: TypeError: ‘list’ object is not callable The relevant code in main.py is: from …

Total answers: 1

Why am I seeing "TypeError: string indices must be integers" in this situation?

Why am I seeing "TypeError: string indices must be integers" in this situation? Question: im trying to predict stock market movement but in the start i’m stuck in this error: "TypeError: string indices must be integers" the code that i have problem with is: import pandas_datareader as web df = web.DataReader(‘AAPL’, data_source=’yahoo’, start=’2012-01-01′, end=’2019-12-17′) TypeError: …

Total answers: 1

Function as argument raises TypeError ndarray

Function as argument raises TypeError ndarray Question: I have to analyse a mass with variable acceleration. The first function defines acceleration. The second return arrays for respectively place, speed and acceleration at time t. (t goes from 0-10 with increments of 0.1) import numpy as np import matplotlib.pyplot as plt dt = 0.1 t0 = …

Total answers: 1

Pyhton Move Between Rooms

Pyhton Move Between Rooms Question: I am trying to move between rooms using a dict and I can navigate if the room only has 1 location to move to but when it has more than one I get an error. # The dictionary links a room to other rooms. rooms = { ‘Great Hall’: {‘South’: …

Total answers: 1

Using lambda function to switch between different functions in python gives TypeError if invalid function name is given with argument

Using lambda function to switch between different functions in python gives TypeError if invalid function name is given with argument Question: I recently learned lambda functions and switch case and I’m playing with them to understand better. Here, I’m trying to use lambda function to switch between different functions in python like the following def …

Total answers: 2

`TypeError: missing 1 required positional argument: 'self'` Whitebox tools

`TypeError: missing 1 required positional argument: 'self'` Whitebox tools Question: I am attempting to use whitebox geospatial tools to analyze .tif files. Any whitebox tool I run however, raises the error: TypeError: missing 1 required positional argument: ‘self’. I understand that this is a well-documented error within the stack overflow community, however, the way I …

Total answers: 1

'>=' not supported between instances of 'method' and 'int'

'>=' not supported between instances of 'method' and 'int' Question: Here is the method causing the error: class Kilpailu(): def __init__(self, nimi, pituuskm, osallistujat): self.nimi = nimi self.pituuskm = pituuskm self.osallistujat = osallistujat def kilpailu_ohi(self): for i in self.osallistujat: if (i.getKuljettuMatka>=self.pituuskm): return True else: return False edit: here is also where getKuljettuMatka is defined class …

Total answers: 1