Q about str | Sololearn: Learn to code for FREE!
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 Respostas
+ 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