Can you help me with this code please? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you help me with this code please?

Coding question https://code.sololearn.com/csHZc160R7V3/?ref=app

17th Sep 2021, 2:32 PM
Emma Cooke
22 Answers
+ 3
Pooja Patel , the code you have posted here looks 100% identical to a post from @Pusparasa Ayilavan that he has posted one month ago in the current post. > did you just copy and paste it ???
15th Nov 2022, 12:03 PM
Lothar
Lothar - avatar
+ 2
ok - i found it: Given a list of numbers, output "bingo" if it contains the input number. Do not output anything if the number is not found. so the code could be like: x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input()) if num in x: print('bingo') doing it with a for loop: x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] for lst_num in x: if num == lst_num: print('bingo')
17th Sep 2021, 2:53 PM
Lothar
Lothar - avatar
+ 2
items = [42, 88, 721, 12, 43, 22, 908] num = int(input()) #your code goes here for lst_num in items: if num == lst_num: print('bingo')
26th Sep 2022, 4:38 PM
Pusparasa Ayilavan
Pusparasa Ayilavan - avatar
+ 2
this should work: x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input()) if num in x: print ("bingo")
4th Oct 2022, 8:49 AM
Faisal Ramahi
+ 2
x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input( ) ) if num in x: print( "bingo" ) is also right answer
30th Oct 2022, 1:32 PM
Abhishek Maheshwari
Abhishek Maheshwari - avatar
+ 1
The following should work... :D x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input()) if num in x: print ("bingo")
30th Jul 2022, 9:11 PM
roxsie
roxsie - avatar
+ 1
You can write like this also x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input()) if num in x: print("bingo") else: print()
6th Apr 2023, 6:09 PM
Asma Sulthana
Asma Sulthana - avatar
0
Comment or remove 2nd line of taking user input. What are you trying with this code? pls add more details...
17th Sep 2021, 2:49 PM
Jayakrishna 🇮🇳
0
num = int(input()) if num in x: print ("bingo")
26th Sep 2022, 4:36 PM
Pusparasa Ayilavan
Pusparasa Ayilavan - avatar
0
items = [42, 88, 721, 12, 43, 22, 908] num = int(input()) #your code goes here for lst_num in items: if num == lst_num: print('bingo')
15th Nov 2022, 8:02 AM
Pooja Patel
Pooja Patel - avatar
0
x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input( ) ) if num in x: print( "bingo" )
28th Oct 2023, 10:28 AM
Azmeera Shanthi
Azmeera Shanthi - avatar
- 1
Emma Cooke , please specify the name of the python tutorial , also the lesson / exercise number. to give qualified help, we need to see the task description. thanks!
17th Sep 2021, 2:48 PM
Lothar
Lothar - avatar
- 1
Change your second lines variable name as num becoz you used same variable name for both the lines python takes the last variable name so you have stucked .Hope this info helps all.
19th Sep 2021, 3:44 AM
SIDDHARTH A
SIDDHARTH A - avatar
- 1
list=[21,34,56,27,85,67,45] print('My list is ',list) n=int(input('Enter any number: ')) for i in range(0,len(list)): if(list[i]==n): print('Bingo')
22nd Dec 2021, 9:35 AM
SANVIKA
- 1
Can try this items = [42, 88, 721, 12, 43, 22, 908] num = int(input()) if num == items[0] or num == items[1] or num == items[2] or num == items[3] or num == items[4] or num == items[5] or num == items[6]: print("bingo")
8th Jan 2022, 7:34 PM
Ihor Princ
Ihor Princ - avatar
- 1
its becoz you havent completed the course before it . I am also using the free course
2nd Feb 2022, 4:31 PM
LAKSHYA CHHABRA
- 2
I'm not sure tbh. I'm new to this so it's all trial and error. Just trying it for a bit of fun.
17th Sep 2021, 2:37 PM
Emma Cooke
- 2
or You can solve like this items = [42, 88, 721, 12, 43, 22, 908] num = int(input()) if num == items[0]: print("bingo") elif num == items[1]: print("bingo") elif num == items[2]: print("bingo") elif num == items[3]: print("bingo") elif num == items[4]: print("bingo") elif num == items[5]: print("bingo") elif num == items[6]: print("bingo")
8th Jan 2022, 7:37 PM
Ihor Princ
Ihor Princ - avatar
- 2
x = [42, 8, 7, 1, 0, 124, 8897, 555, 3, 67, 99] num = int(input()) if num in x: print('bingo') done...!
5th Mar 2022, 5:27 AM
Nikhila
- 3
says to activte my account to use ‘messenger’; how on earth do I do that, received no such email.
19th Sep 2021, 2:44 PM
Galen Burnett
Galen Burnett - avatar