[Solved] Why is there a blank line between my print and raw_input lines?

EDIT The conclusion from the discussion in the comments is it’s a bug in Canopy IDE. The code you’re showing us is not the code you’re running. Your output is this: Available Letters: abcdefghijklmnopqrstuwxyz. Which is supposed to be printed by this (note the dot added on the end): print “Available Letters: ” + getAvailableLetters(lettersGuessed) … Read more

[Solved] Squaring the odd number and squaring the number-1 if number is even [closed]

Here is easy sample code to understand: def odd_square(number): if number == 0: return 0 elif number % 2 == 1: return number*number else: return (number – 1)*(number – 1) square = odd_square(int(input(“Enter number to square: “))) print(“square is: “,square) you need to convert number to integer as input() returns string. TypeError: odd_square() takes 0 … Read more

[Solved] How do I make a custom discord bot @ someone that a person @ed in the command?

To mention a user you have to define it beforehand. You do this as follows: user = message.mentions[0] To mention the user you can either use f-strings or format. Based on the code above here is an example: @client.event # Or whatever you use async def on_message(message): user = message.mentions[0] if message.content.startswith(‘!best’): await message.channel.send(“Hello, {}”.format(user.mention)) … Read more

[Solved] Compare one item of a dictionary to another item in a dictionary one by one [closed]

Assuming the keys (here, prompt) of both dictionaries are the same, or at least for every key in the answers dictionary, there is a matching response prompt, then you can count them like so count = 0 for prompt, response in responses.items(): if response == answers.get(prompt, None): count += 1 return count 1 solved Compare … Read more

[Solved] Access dict via dict.key

You can implement a custom dict wrapper (either a subclass of dict or something that contains a dict) and implement __getattr__ (or __getattribute__) to return data from the dict. class DictObject(object): def __init__(self, data): self.mydict = data def __getattr__(self, attr): if attr in self.mydict: return self.mydict[attr] return super(self, DictObject).__getattr__(attr) solved Access dict via dict.key

[Solved] interpreting the confusion matrix [closed]

Remove id feature, also check and remove any features which you think add no value to prediction (any other features like id) or features with unique values. Also check if there is any class imbalance (how many samples of each class are present in data, is there proper balance among the classes?). Then try applying … Read more