To accept Python inputs and truncate strings

Asked 2 years ago, Updated 2 years ago, 18 views

How do I calculate the number of floors by receiving the number of floors when writing this code?(Crying)

python

2022-09-20 19:47

1 Answers

def floor(location):
    return int(location[:-2])

floor = lambda x: int(x[:-2]) 

If you receive an input, it's in the form of str, so make a function that returns to the integer type after the two, or just change it to the integer type.

I wonder if it will be helpful to write an answer if you don't show the progress of your efforts when you ask a lot of questions about what you are studying.

You have to bump into each other to be strong, but I feel like I've deprived you of the chance to be strong

Thank you.


2022-09-20 19:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.