bennyanderson7704 bennyanderson7704
  • 22-11-2021
  • Computers and Technology
contestada

Assume you have assigned x the string value of "125,000" (i.e., x = "125,000"). Can you find a string method that tests if x only contains digits?

Respuesta :

holmtheditto
holmtheditto holmtheditto
  • 22-11-2021

Answer:

x = x.replace(',', '')

print(x.isdigit())

Explanation:

isdigit() is a built-in checking method which checks if a string contains all digit values or not. Since x contains a ',' it has to be removed and since strings are immutable, i create a new string without the comma. Then I check if it is a digit, in which case it is true.

Answer Link

Otras preguntas

Based on this information, which of the following new combinations of race car characteristics would most likely be the fastest? OA. straw diameter = 0.75 cm, c
(looking for) similar meaning ?​
write each subtraction equation as an addition equation a - 9 = 6 p - 20 = -30 z - (-12) = 15 x - (-7) = -10
Escaping a war in one's country of origin as a reason for immigrating to another country is an example of a Opull factor.
THIS IS EASY ++ WILL GIVE BRAINLIEST ! TYSM
(100 words) Why was the enslavement of Africans in the American colonies “gradual”? What labor system existed in the colonies prior to black enslavement?
7. What would happen to the movement of infrared photons if we increased the concentration of N₂ or O₂? Choose one of the options below and explain your choice:
I dont understand this at all so here is 100 points
240 % of a number is 68000, what is that number
need help with question 2 pleasee