from swampy.TurtleWorld import *
import random
world = TurtleWorld()
Turtle_1 = Turtle()
print('*****Welcome to Sehir Minesweeper*****')
print('-----First Turtle-----')
Turtle_1 = input('Please type the name of the first Turtle:')
print('Turtle 1 is' +' ' + Turtle_1)
T1_color = input('Please choose turtle color for' + ' ' + Turtle_1 +' '+'(red, blue or green):')
Turtle_1.color(T1_color)
TypeError: 'str' object is not callable while trying to use python swampy
438 Views Asked by yusuf ziya ozgul At
2
You created
Turtle_1
as aTurtle
object, which is correct. Then, however, with the lineTurtle_1 = input('Please...')
, you setTurtle_1
to a string, asinput()
returns a string. When you then attempted to call thecolor()
method, this did not work, as strings have no such method. In addition, Turtles also have theset_color()
method for setting the color, andcolor
is an attribute and cannot be called.