Ask coding questions

← Back to all posts
Why is there a "none" after everything typed?
bohandong (0)

Why does it keep typing none?

Answered by JBloves27 (1515) [earned 5 cycles]
View Answer
Comments
hotnewtop
JBloves27 (1515)

aha, i had this error once as well. Something like it Anyways, so because you added the module emoji, and its not a real module, i cant find the exact error. But I have a guess. So the print("Welcome {}...")? Fix that. Instead of that, use print("Welcome {name}") that is much better and easier
I hope this helps!

bohandong (0)

@JBYT27 I tried that just now and it doesn't work!

JBloves27 (1515)

Umm, you have to put the brackets INSIDE the parentheses. without the comma. And add a f before the parentheses. lol. Heres what you have to do:

print(f"Welcome {name}") 

That should work @bohandong

bohandong (0)

@JBYT27 Thanks for the info but how does this have to do with stopping it from printing "None"?

JBloves27 (1515)

Well, I think your function/module command was wrong, or it just doesn't work. It also could be outdated @bohandong

Coder100 (15490)

where is this happening anyways @bohandong

bohandong (0)

@Coder100 on the blackboard thingy (where all the printed stuff goes)

bohandong (0)

oh it is back again

JBloves27 (1515)

ummm, i dont think so. Its ok for me @bohandong
Edit: Seems like there is no such module called emoji

JBloves27 (1515)

where? maybe try forking it and then try again? @bohandong

JBloves27 (1515)

Let me try forking it and ill invite you @bohandong

JBloves27 (1515)

I found the error. So a input cannot be a print, and you put cprint, which does not work with an input. So you have to take off the colors for it to work @bohandong

JBloves27 (1515)

So yeah, the errors fixed, you just want to change what RYANTADIPARTHI wants you to change pretty much. Glad I helped! @bohandong

bhavreenkaur (0)

hi im 9 i dont think i can help but Most of the python function raises TypeError if None is passed as an argument. Take any function say chr(None) and see it raises TypeError . This will prevent someone from passing you the wrong type, as well as dealing with the None issue. It will return an AssertionError , as per the docs.

tussiez (777)

@bhavreenkaur Hello there!
Unfortunately, if you are under the age of 13, I don't believe you can participate in Repl Talk.

RYANTADIPARTHI (5826)

Solution

i don't know what you mean by none. i just tried it, and nothing says none but you do have a ValueError. To fix this, remove the termcolor.colored(), you cannot use that with inputs.

while True:
  print(termcolor.colored("Enter the number that you want to do E.g 1 for addition...","yellow"))
  ask_questions = int(input("Do you want to do 1.+ 2.− 3.÷ 4.× 5. shop: "))

  if ask_questions == 1:
  #add question 0
    addition_questions = int(input(termcolor.colored("10 + 10 = ","yellow")))

like that. Once you do that, everything should work. There is no such thing called none in your output.
That should work

JBloves27 (1515)

I think there was a none error. Its just @bohandong sees it still, but not us @RYANTADIPARTHI

sry for pings

bohandong (0)

@RYANTADIPARTHI My part that says None is this part in the output:
staff:
Hi there! How can I help you?
Would you like to have a look at our items(y/n)?
None

RYANTADIPARTHI (5826)

@JBYT27 well, idk about that, but, maybe eventually I'll see it.

JBloves27 (1515)

could you remove the emoji module and it's functions? because with it, we cant see the error at all @bohandong

RYANTADIPARTHI (5826)

@bohandong another error no module named emoji. i can't get to that part because of the error.

bohandong (0)

@RYANTADIPARTHI I have deleted all emoji related things
and still appears (None)

RYANTADIPARTHI (5826)

@bohandong ok, so before i can get to the none parts, you have that ValueError. I tell you how to solve it on my first comment.

RYANTADIPARTHI (5826)

@bohandong read my first comment. You have to solve that error first.

bohandong (0)

@RYANTADIPARTHI Do you mean deleting every one of the inputs with the termcolor.colored?

RYANTADIPARTHI (5826)

@bohandong yes. Also, if you want to be able to type shopin, you have to not put int, since it's a integer, and shop is a string.

bohandong (0)

@RYANTADIPARTHI No i just want to type the numbers

RYANTADIPARTHI (5826)

@bohandong yes, then how will you type shop? shop is a string.

bohandong (0)

@RYANTADIPARTHI 5 = shop i type 5 instead of shop

RYANTADIPARTHI (5826)

@bohandong oh ok. Tell me how to get to the none part.