Hello,
Can someone please help me with a little problem that I am having splitting strings?
I am trying to remove everything more than 2 - digits to the right of a decimal point in a string.
For some reason I am not realizing my desired results. If you could just give me a few hints without giving me the answer I would greatly appreciate it.
Thank You,
HR
# This program demonstrates the split method.
def main():
# Create a string with multiple words.
my_string = '1247.123456789'
# Split the string.
number_list = my_string.split('.')
secondString = number_list[1:2]
secondString = secondString[0 : 2]
print(secondString)
# Call the main function.
main()