0

How to change the string Into a number

https://code.sololearn.com/c2unzyuzfTy0/?ref=app

10th Mar 2023, 12:57 AM
Ammar Alshawafi
Ammar Alshawafi - avatar
6 Antworten
+ 9
Use int function string = '123' print(int(string)) read the description again you have to take inputs and split it to convert in list then you have to compare each value of the list with given conditions like water cost is 4 so for x in list: if x == 'water': cost = cost + 4 elif x == 'pizza' cost = cost + 6 after getting final cost do calculation as per given conditions to get final value.
10th Mar 2023, 2:04 AM
A͢J
A͢J - avatar
+ 4
Example like this:- n = int(input("enter number")) So, if we input anything from the user by default it takes input into string so if you want to convert into integers data type then you can put int before the input.
10th Mar 2023, 6:57 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 4
friend.... thats what chatGPT is good for. Give it a try! It will be your companion in future.
10th Mar 2023, 8:23 AM
Oma Falk
Oma Falk - avatar
+ 2
Python can know numbers without any thing but to make sure you can add int () to you code
11th Mar 2023, 11:02 PM
Youssif Abbas
Youssif Abbas - avatar
0
Turn the ‘123’ into a “123”
10th Mar 2023, 4:46 PM
Jason Nguyen
Jason Nguyen - avatar