Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

HackerRank Detect Floating point number solution in python

YASH PAL, 31 July 2024

In Detect floating-point number problem You are given a string N. Your task is to verify that N is a floating-point number.

HackerRank Detect Floating point number solution in python

Problem solution in Python 2 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT

import re

for k in range(int(raw_input())):
    print bool(re.match(r"^[+-]?([0-9]+)?.[0-9]+$",raw_input()))

Problem solution in Python 3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
for _ in range(int(input())):
    print(re.search(r'^([-+])?d*.d+$', input()) is not None)

Problem solution in pypy programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
import re 

for _ in xrange(int(raw_input())):
    print bool(re.search(r"^[+-]?[0-9]*.[0-9]+$", raw_input().strip()))

Problem solution in pypy3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
n= int(input())
numbers = []
for i in range(n):
    i = input()
    numbers.append(i)
#print(len(numbers))
for i in numbers:
    print(bool(re.search(r'^[-+]?[0-9]*.[0-9]+$',i)))

coding problems python

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes