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

30th Aug 2016, 9:56 PM
Peter
Peter - avatar
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"
31st Aug 2016, 5:25 PM
Paddy Storey
Paddy Storey - avatar
+ 1
<form> <input type="text" name="color" list ="colors" /> <datalist id=" colors "> <option value="Red"> <option value="Blue"> <option value="Green"> </ datalist > </form>
7th Feb 2019, 2:52 PM
Ibrahim Aldesoky Gharib Ismaeil
Ibrahim Aldesoky Gharib Ismaeil - avatar
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))
31st Aug 2016, 5:06 PM
beauty1234
0
def print else:
10th Feb 2021, 12:09 PM
Md Momin Uddin Hridoy
Md Momin Uddin Hridoy - avatar
0
def even(x): if x%2 == 0: print("Yes") else: print("No")
24th May 2021, 11:01 AM
Hayder Jawad Al-ATBEE
Hayder Jawad Al-ATBEE - avatar
0
def print else:
17th Aug 2022, 7:34 AM
bita sadegh zadeh farid
bita sadegh zadeh farid - avatar
- 2
def even(x): if x%2 == 0: print("Numero Par ") else: print("Numero impar") x = int(input("Deme un numero: ")) even(x) Funciona
10th Apr 2018, 11:42 PM
Luis Gonzalez
Luis Gonzalez - avatar
- 2
def even(x): if x%2 == 0: print ("Yes") else: print("No")
26th Oct 2018, 8:18 AM
Houcem Eddine Aouissaoui
Houcem Eddine Aouissaoui - avatar
- 3
jtrjy-
30th Jan 2018, 7:27 PM
Ibrahim Bousserhane
Ibrahim Bousserhane - avatar
- 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
9th Jan 2019, 9:47 PM
souad