Q about str | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Q about str

How to multiply row elements by each other? Example: a = str (input()) # maybe it wood be "5, 5", so i want to make 5 * 5 = 25, how can i do this?

19th Jul 2023, 11:13 AM
Тимоки
Тимоки - avatar
7 Answers
+ 4
split the string by the separator, e.g. x = "1,2".split(",") You get a list of strings. Convert each element to integer and multiply the elements.
19th Jul 2023, 12:00 PM
Lisa
Lisa - avatar
+ 7
Тимоки , To get elements in a row...you can use map function... Try like this, https://code.sololearn.com/cHw1dBIhKlGr/?ref=app
19th Jul 2023, 11:22 AM
Riya
Riya - avatar
+ 6
Тимоки , This is task description... Can you show your attempted code??
19th Jul 2023, 11:34 AM
Riya
Riya - avatar
+ 3
Тимоки There are many ways to do this, but each method is dependant on how the input string is presented. If you could provide a code example of your input, we may be able to show how to create your desired output
19th Jul 2023, 11:26 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Тимоки This platform is not available to provide ready code. So try by yourself. If you face any problems in during making code then ask here.
19th Jul 2023, 11:19 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 2
Rik Wittkopp, Balconies You are trying to determine which of two apartments has a larger balcony. Both balconies are rectangles, and you have the length and width, but you need the area. Task Evaluate the area of two different balconies and determine which one is bigger. Input Format Your inputs are two strings where the measurements for height and width are separated by a comma. The first one represents apartment A, the second represents apartment B. Output Format: A string that says whether apartment A or apartment B has a larger balcony. Sample Input '5,5' '2,10' Sample Output Apartment A
19th Jul 2023, 11:32 AM
Тимоки
Тимоки - avatar
0
I deleted it, cause of anger)
19th Jul 2023, 11:35 AM
Тимоки
Тимоки - avatar