تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Question 3 (1 point)
A problem you are trying to solve has a string named lorem that has been split word by word (using the
string split method with a sep=) to create a new list named lorem2, as seen in the starter code below:
Starter Code:
loren 'lorem ipsum dolor sit ad dolore consectetur adipiscing elit sed aliqua
loren2
loren.split(sep)
# ploce your code below this line ww
es place your code above this Line #
print(dictD)
You have been asked to do the following:
•
Place your script between the markers named: '### place your code below this line ###' and
'### place your code above this line ###'.
•
Create a new dictionary named dictD
•
•
•
Use a for loop with a sorted (ascending order) statement for your lorem2 list
Inside your for loop statement, add key value pairs to your new dictionary named dictD, using
each word in the lorem2 list as the dictionary key, and the dictionary value being length of
characters for the word being added to your dictionary named dictD.
The last line of your script has a print statement for your dict that will provide the sample
output below.
Sample Output:
('ad': 2, adipiscing': 10, 'aliqua': 6, consectetur': 11,
'dolor: 5, 'dolore': 6, 'elit': 4, 'ipsum': 5, 'lorem': 5,
'sed': 3, 'sit': 3}
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.