How do i get the output like this ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do i get the output like this ?

a= (int(input("input values: "))) if values are not input will appear a message "values need to be input".

1st Jan 2020, 7:03 AM
dany setyawan
dany setyawan - avatar
9 Answers
+ 3
dany setyawan First you must try it on your personal computer and not in sololearn. And then what's the error?
1st Jan 2020, 8:52 AM
Qasem
+ 3
Thank for the advice guys. I really appreciate it
2nd Jan 2020, 4:03 PM
dany setyawan
dany setyawan - avatar
+ 2
dany setyawan By using Exception Handling we can trap common or custom exception (error). If you have read that chapter I believe you can use try...except block while getting input to check whether the input is convertible to `int` type. while True: try: n = int(input("Enter an integer: ")) print("Okay the integer input is", n) break except(TypeError, ValueError): print("Input must be integer") except EOFError: print("You give blank input") break I strongly suggest you to read that chapter on 👍
1st Jan 2020, 9:04 AM
Ipang
+ 2
a=input() if a=='': print("values need to be input") else: print("input values:",int(a))
1st Jan 2020, 3:41 PM
Solo
Solo - avatar
+ 1
Ipang i still dont get it
1st Jan 2020, 8:36 AM
dany setyawan
dany setyawan - avatar
0
a='' While a=='' a=int (input ()) Print ("values need...")
1st Jan 2020, 8:00 AM
Qasem
1st Jan 2020, 8:14 AM
Ipang
0
Qasem I try yours code but it not work
1st Jan 2020, 8:35 AM
dany setyawan
dany setyawan - avatar
0
When im not input the values, there is a message that i have to input a values in format int().
1st Jan 2020, 8:38 AM
dany setyawan
dany setyawan - avatar