How to write a python script, that converts a string format number into 'real' number: integer, float.

0 Robert Trumpet · September 18, 2015
 I need to implement python built-in type convert function: 


The code should convert the following 3 strings into real values:
   (1) "7343345"
   (2) "-87634"
   (3) "98.783"


   What python functions are not allowed:
1.  the type convert function itself: int(), float()


In other words....
Define a function, that takes a string format number as input, and return the number itself. 
e.g. def stringToNumber(str):
         #your code here
           return number

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 sfolje 0 · September 19, 2015
You can't convert string "7343345" to number without build-in function or thirt party function.
0 Bernard Pyc0d333 Parah · September 19, 2015
yup...he used isdigit() which is built-in
  • 1
  • 2

Python

130,044 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator