0
Fill in the blanks to define a function that prints "Yes", if its parameter is an even number, and "No" otherwise.
Fill in the blanks to define a function that prints "Yes", if its parameter is an even number, and "No" otherwise. please can someone help me with the code? even(x): if x%2 == 0: ("Yes") print("No") my input are def, print else it will marked it green but still not correct
10 Antworten
+ 4
You just forgot to place a colon after your else statement.
I did the same mistake.
def even(x):
if x%2 == 0:
print("Yes")
else:
print("No")
#This should work, By giving "No output"
+ 1
<form>
<input type="text" name="color"
list
="colors" />
<datalist id="
colors
">
<option value="Red">
<option value="Blue">
<option value="Green">
</
datalist
>
</form>
0
input is type string , if compare x%2 you need to convert to int
try this
def even(value):
if value % 2== 0:
print("\n" , value, "is Even.")
else:
print("\n" , value, "is Odd.")
x = input("Enter value : ")
print(int(x))
even(int(x))
0
def
print
else:
0
def even(x):
if x%2 == 0:
print("Yes")
else:
print("No")
0
def
print
else:
- 2
def even(x):
if x%2 == 0:
print("Numero Par ")
else:
print("Numero impar")
x = int(input("Deme un numero: "))
even(x)
Funciona
- 2
def even(x):
if x%2 == 0:
print ("Yes")
else:
print("No")
- 3
jtrjy-
- 4
Fill in the blanks to associate the input with the datalist
<form>
<input type="text" name="color"
="colors" />
<datalist id="
">
<option value="Red">
<option value="Blue">
<option value="Green">
</
>
</form>
i need unswer pleas