Where i am wrong here?


class Person:
  def init(self, name):
        self.name = name
  def greet(self, other_name):
        return "Hi {0}, my name is {1}".format(other_name, name)


is this part of an exercise? if so, can you provide the exercise urL?

how did i miss this? __init__() is a magic method, which means underscores are required, they are missing in your case


No actually its not the part of code academy exercise .But here is a link for it .


did you see the edit i did:

if you send the url of the kata i can also have a look at the kata


full functionality. It does NOT run in Internet Explorer.

import random
guess = random.randint(1,100)
m = 0
while m < 10:
    guess = raw_input("Enter the value")
    if guess == 50:
        print "Right"
    elif guess > 50:
        print "High"
        print "you guess is low"
    m = m + 1

The error is

Enter the number
Traceback (most recent call last):
File "", line 6, in

Which kind of error does it displaying ?


I am building simple random number guessing game and i find its difficult to apply concepts .Although i have descent idea of syntax still i am struggling to get result by applying them .Can u suggest me its quite usual for beginners or is there anything wrong with me , and how to get out of it .


Are u busy some where else?


codecademy -> international, i was asleep, it was night at where i live.

anyway, a huge problem is here:

guess = raw_input("Enter the value")

raw_input stores as string, we can see this:

print type(guess)

comparing strings and integers == bad idea.

convert to an integer:

guess = int(raw_input("Enter the value"))

depending on what you are going to use this program fo, you might need to validate the user actually enters a integer, otherwise a ValueError will be raised


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.