What is the output of the dict={1:'dict',2:'B',3:'C'} for i,j in dict.items(): print(i,j,end=' ') | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of the dict={1:'dict',2:'B',3:'C'} for i,j in dict.items(): print(i,j,end=' ')

Pls tell the output

27th Dec 2023, 2:30 AM
Rajini Srinivasan
Rajini Srinivasan - avatar
7 Answers
+ 6
Rajini Srinivasan , Is there something stopping you from running it in the playground?
27th Dec 2023, 4:19 AM
Rain
Rain - avatar
+ 5
Rajini Srinivasan , since you have not started learning from a *sololearn python tutorial* (you signed in to sololearn at the same time the question was posted), it looks like your question is from a homework or something like this. this is how it works roughly: > the dictionary has 3 items > a loop is running for each item > each item is splitted to individual variables > the variables with the keys / values are printed
27th Dec 2023, 6:53 AM
Lothar
Lothar - avatar
+ 2
Rajini Srinivasan, As mentioned by Rain try to run the code in playground first and if you face any problems then you can use the forum. https://www.sololearn.com/discuss/1316935/?ref=app
27th Dec 2023, 4:40 AM
卂ㄚㄩ丂卄
卂ㄚㄩ丂卄 - avatar
+ 2
Rajini Srinivasan , Since Lothar pointed out you're brand new to Sololearn, let me give you the path to the part of the interface where you can write and run your own code. Back out of the Q&A Discussions area and any other areas in your history until you can see the Create button. Hit Create. Change the dropdown menu from "Hot Today" to "My Code Bits". (It won't list any files yet, but it will later.) Hit the round button with the + sign on it (meaning new file). Choose Python. Paste your code into the editor. (Edit it so the statements are on separate lines with proper indentation, since your paste above looks smashed together.) Hit Run to see the output or any errors. Keep editing until you're satisfied In the three-dots menu, choose Save, and name it. Leave it set to the default, "Private". (You can change it to "Public" later if you need others to see it.) When you exit the editor, since the dropdown is on "My Code Bits", you'll see the file you just saved listed there.
27th Dec 2023, 7:56 AM
Rain
Rain - avatar
+ 1
Shantanu Kanojia , but without commas (and assuming proper code indentation) 1 dict 2 B 3 C
27th Dec 2023, 8:29 PM
Rain
Rain - avatar
+ 1
Rain , Yeah right ✅️
27th Dec 2023, 8:34 PM
Shantanu Kanojia
Shantanu Kanojia - avatar
0
1 dict 2 B 3 C
29th Dec 2023, 2:39 AM
Annihilate
Annihilate - avatar