+ 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".
9 odpowiedzi
+ 3
dany setyawan
First you must try it on your personal computer and not in sololearn.
And then what's the error?
+ 3
Thank for the advice guys. I really appreciate it
+ 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 👍
+ 2
a=input()
if a=='':
print("values need to be input")
else:
print("input values:",int(a))
+ 1
Ipang i still dont get it
0
a=''
While a==''
a=int (input ())
Print ("values need...")
0
Check the lesson about Exception Handling
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2440/
0
Qasem I try yours code but it not work
0
When im not input the values, there is a message that i have to input a values in format int().