Ballpark orders challenge in the code coach, I'm stuck in it, i don't know how to use the for loops to solve it, help please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Ballpark orders challenge in the code coach, I'm stuck in it, i don't know how to use the for loops to solve it, help please.

Python basics https://code.sololearn.com/ckCvf9s0W3va/?ref=app

28th Feb 2023, 1:54 PM
Wesam Sobhy
Wesam Sobhy - avatar
6 Answers
+ 3
1. Never use existing names to name new functions (or variables, classes, or anything else). "def list" overwrites existng class "list", what can get you weird and hard to debug issues. Use unique and descriptive names instead. 2. If you want to convert the string into a list, study function "split" again. Hint: it already retuns a list, no further processing required. 3. Your "list" function does nothing. I recommend studying again the lessons on functions. 4. You need to include, in your code, the relationship between items and values. This will allow you to replace words with prices. How do you intend to include this data? After this, we can move to the conversion part.
28th Feb 2023, 2:23 PM
Emerson Prado
Emerson Prado - avatar
+ 2
Can you please add the task? Your code isn't finished. Also, python's input is automatically a string, so trying to convert it to a string doesn't help.
28th Feb 2023, 2:01 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
You've added the input, Water etc, but not what you need to do. Copy the question/task.
28th Feb 2023, 2:13 PM
Ausgrindtube
Ausgrindtube - avatar
0
Yes, I'm sorry, the input is Water Coke Cheeseburger Pizza
28th Feb 2023, 2:03 PM
Wesam Sobhy
Wesam Sobhy - avatar
0
Strings formed of these words, in the task they need me to replace these words with their prices, and then sum them and add the taxes
28th Feb 2023, 2:05 PM
Wesam Sobhy
Wesam Sobhy - avatar
0
I converted the input to list, and split them by commas, because they were separated by spaces, now I need to use the for loops to convert the list of strings to a list of numbers (the prices) and then sum them and add the taxes
28th Feb 2023, 2:07 PM
Wesam Sobhy
Wesam Sobhy - avatar