Phyton if question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Phyton if question

import random A= [ "Kevin","Milan","Lucas","Roma","federico"] print (random.choice(A)) Gay = ['gay','cool','raar','lelijk','bol'] print (random.choice(Gay)) if 'federico' == "bol": print ('klopt') I have this. But the last part doesn't work. how can I fix this?

17th Feb 2022, 8:43 PM
Robin hamerslag
5 Answers
+ 1
Thank you
17th Feb 2022, 9:00 PM
Robin hamerslag
0
if 'federico' == "bol": how thes two are equal? Never. What are trying by this?
17th Feb 2022, 8:46 PM
Jayakrishna 🇮🇳
0
Its my first time so i dont really get it i just want to if the name is federico that (klopt( is says in the text
17th Feb 2022, 8:47 PM
Robin hamerslag
0
import random A= [ "Kevin","Milan","Lucas","Roma","federico"] name = random.choice(A) #strore into a variable print(name) Gay = ['gay','cool','raar','lelijk','bol'] x = random.choice(Gay) #store into varisble print(x) if name == 'federico' or x=="bol": #using here print('any one true','klopt',1) if name == 'federico' and x=="bol": print('both true','klopt',2) if name == 'federico': print ('klopt',3) if x=="bol": print ('klopt',4) print("finished")
17th Feb 2022, 9:00 PM
Jayakrishna 🇮🇳
0
You can do something like this. Nice little concept tho lol. https://code.sololearn.com/cxQ0WIXy3NmN/?ref=app
17th Feb 2022, 9:26 PM
Ion Kare
Ion Kare - avatar