>>> b = "3"+b[2:] #Removing the decimal point so that there are digits only in >> >> my_number = 3.14159 > > Here you assign a floating point number to mmy_number but > the code Sama wrote was for working with strings read > from a text file. > > You would need to convert it first: > > my_number = str(3.14159) > >> my_number = "3"+my_number[2:] >> print(my_number)
Thanks for the clarification. I tested this approach, and I noticed one weird thing: Pi_Number = str(3.14159265358979323846264338327950288419716939) Pi_Number = "3" + Pi_Number[2:] print(Pi_Number) == RESTART: C:\Users\Rafael\Documents\01 - BIZ\CODING\Python Code\PPC_56.py == 3141592653589793 >>> How come that not the entire string is being printed, but only the first 16 digits? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor