I want that the user will decide the value of x in the first line. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want that the user will decide the value of x in the first line.

x=int(input('enter values :')) if x<=10 : print ('''condition true''') else : print ('''invalid''')

18th Jul 2020, 6:28 AM
Ajay
Ajay - avatar
15 Answers
+ 3
Ajay when you x= int(input()) you are changing x value if you mean you can't change 10 then add y = int(input()) to change y then instead of if ( x <= 10 ): change to if ( x <= y ):
18th Jul 2020, 6:56 AM
BroFar
BroFar - avatar
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 I was in the heat of the moment 🤣🤣🤣 I am not usually profane. Sorry...
18th Jul 2020, 6:38 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 2
Tomiwa Joseph it is sometimes better to step away than bang your head ....
18th Jul 2020, 6:41 AM
BroFar
BroFar - avatar
+ 2
it is sometimes better to step away than bang your head .... Wise words BroFar
18th Jul 2020, 6:44 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 1
Tomiwa Joseph words please... Ajay is new here and may not understand anything at all yet.
18th Jul 2020, 6:37 AM
BroFar
BroFar - avatar
0
Ok
18th Jul 2020, 6:42 AM
Ajay
Ajay - avatar
0
1) you use ''' ......''' in your print(....). You have the choice only between "......" and '......' 2) actually your code does what you except but if you want the decision in a single line (I do not know if it is what you mean!) use: x=int(input('enter values :\n'))
18th Jul 2020, 6:44 AM
yyy
0
Now code like that to have output . My output is error But I want like that Enter value :8 Condition true
18th Jul 2020, 6:46 AM
Ajay
Ajay - avatar
0
Can I not change the value of x in kiibo ghayal code
18th Jul 2020, 6:55 AM
Ajay
Ajay - avatar
0
I know very good when """...........""" are used in Python! It is not pythonic to use them to print a single word! I leave that Forum!!!
18th Jul 2020, 7:04 AM
yyy
0
x=str(input('enter values :')) x = list(x.split(',')) if len(x) <=10 : print('''condition true''') else: print('''invalid''') Did you mean this??
18th Jul 2020, 10:48 PM
madeline
madeline - avatar
0
But how?, kiibo
19th Jul 2020, 4:32 AM
Ajay
Ajay - avatar
0
Ajay You have added comments b in print statement instead of using "' Use " double quote or ' single quote
19th Jul 2020, 7:37 PM
MANSOOR PASHA
MANSOOR PASHA - avatar
- 2
Read it
18th Jul 2020, 12:46 PM
lekhanshu gaur
lekhanshu gaur - avatar