Why my code is not working?? | SoloLearn: Learn to code for FREE!

+1

Why my code is not working??

a = input ("Enter your name: ") b=input("Enter your age: ") print("Hello!" ,a,"You are ", b)

5/9/2021 5:06:02 PM

Devang

26 Answers

New Answer

+6

https://code.sololearn.com/ceveJF53m6Sl/?ref=app U code is running . But why still u have problem in that..🤔

+6

Devang But for me it's running alright. Can u tell me what u gave input to it.

+4

Devang See the code which I had shared above it's working . And it's the one which u have written .

+2

Please show error message

+2

Hi Devang, I think you are entering the input like this "Devang 17" . This will give error as your program requires 2 inputs separated by a newline \r\n character. Try inputting like this ( by pressing nextline on keypad ): Devang 17 This will give you correct result. Regards Roshan

+1

Just change the age into int

+1

Not working in mine miracle

+1

a = input ("Enter your name: ") b=int(input("Enter your age: ")) print("Hello!" ,a,"You are ", b) #My attempt

+1

💖..₥łⱤ₳₵ⱠɆ..💖 sorry but it's showing error

+1

Should work with no problems and for the people commenting use "+" instead of "," and cast age as int.. you can print anything and everything using "," but with an automatic space whereas "+" is used for concatenation of strings, in which case you have to cast numbers and all as str().

+1

its actually working, you just need to input in this format "example 17"

+1

It's right

+1

You did great with the input but you need to concatenate the strings using "+" Like this print("Hello " + a +"You are "+ str(b))

+1

Alto this would invoke a ValueException. I wrote in my reply that he/she should use str() to cast the variables to the string type. Sadly people think its okay to simply concatenate different types and disregard the add operator. Sure you might have no issues now but irl and outside of python, so the rest of the programming field, you will have massive issues with implicit variables.

+1

Wheres8 yeah ur write but he only need to typecast the integer For the age print("You are "+str(b)) Is not it

+1

@Alto Logically correct but its always good practise to make sure everything is right. You dont know what the user will send for both a and b, always good to take caution. Beginners who had Python as their first language have massive understanding issues when it comes to languages like C, C++, Java etc... Dont even look at 8086 Assembly. I think python should be used as a quick hacky language that you use because you already have programmed network sockets etc... in C and need to test stuff. It takes away so much learning and real world information such as pointers or programming logic (python: all wrapped in one function but the beginner doesnt/will never know what happens beneath the hood).

0

B = int(input())

0

There's nothing error in your code because I tried it in pydroid 3 and it's working.

0

This code is not working when You have only 1 input lane in "input". If U press enter/return and create new lane this work fine. Else not work and got crashed coz of SoloLearn.

0

HEY, BRO THIS NOT IDE THIS ANDROID APP HOW TO WORK FOLLOW ME RUN CODE SUMIT OPTION ONLY ONE TIME OPTION value add NAME AGE ___________________________ SUMIT OUTPUT DEAD 0