![]() |
Given a text file, write a Python program to find the smallest number in the given text file. Examples: Input: gfg.txt Output: 9 Explanation: Contents of gfg.txt: I live at 624 Hyderabad. My mobile number is 52367. My favourite number is 9. Numbers present in the text file are 9,624,52367 Minimum number is 9. Approach:
Below is the implementation of the above approach. Python3
Output: Smallest number in the file is: 9 Complexity analysis: Time complexity: O(n) Method : Using sort() method Python3
Output
Smallest number in the file is: 9 Complexity analysis: N is the number of words. Time complexity: O(n) |
Reffered: https://www.geeksforgeeks.org
Python |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |