- 2

Guyz the code isn't running kindly help🥺

phonebook = {'Smith, Jane' : '123-45-67' , 'Doe, John' : '987-65-43', 'Baker, David' : '567-89-01'} def rev(phonebook): print(phonebook) rev={} for key in phonebook: rev=[phonebook[key]]=key print('phonebook',rev) return rev

20th Jan 2022, 5:59 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
7 Respostas
+ 2
Really thankssss alot❤️❤️
20th Jan 2022, 6:21 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
+ 1
It runs just fine. I suspect that the return statement in rev() should be indented one less level so that it allows the loop to complete before it returns. Maybe the print statement should be moved outside the loop, too. The question I have for you is, where is the rest of the code? You define the rev() function but never call it. There is no output because there is no print statement getting executed.
20th Jan 2022, 6:08 PM
Brian
Brian - avatar
+ 1
For key,item in phonebook.items(): rev[item]=key #dedent return rev
20th Jan 2022, 6:12 PM
Oma Falk
Oma Falk - avatar
20th Jan 2022, 6:19 PM
Oma Falk
Oma Falk - avatar
+ 1
boualam bourahla why do you post a copy of my code ?
22nd Jan 2022, 1:42 PM
Oma Falk
Oma Falk - avatar
0
I just want my phonebook to be reversed,can u do that.
20th Jan 2022, 6:10 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar
0
Nope bro ain't running.
20th Jan 2022, 6:15 PM
SAfiullaH KhoKhar
SAfiullaH KhoKhar - avatar