Write a Python function that counts and returns the number of digits appearing in the text file "Space.txt". For example, if the file contains:
Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity’s cosmic journey continues!
Then the function should return 11.
def count_digits():
f = open('Space.txt', 'r')
data = f.read()
f.close()
count = 0
for ch in data:
if ch.isdigit():
count += 1
return count The SELECT statement when combined with \(\_\_\_\_\_\_\) clause, returns records without repetition.
print(16 * 5 / 4 * 2 / 5 - 8)
myStr[:4] extracts the first 4 characters, which are "MISS".myStr[-5:] extracts the last 5 characters, which are "SIPPI"."#" in between, resulting in "MISS#SIPPI".In SQL, the aggregate function which will display the cardinality of the table is \(\_\_\_\_\_\).
Consider the statement given below:
f1 = open("pqr.dat","________")Which of the following is the correct file mode to open the file in read only mode?
Write a Python function that displays the words in which the lowercase letter 'e' appears at least twice in the text file 'Space.txt'. For example, if the file contains:
Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity’s cosmic journey continues!
Then the function should display:
incredible advancements science. agencies serves research.
A csv file "States.csv" contains some data about all the states of India. Each record of the file contains the following data: Name of the State, Capital of the State, Population of the State, Official Language of the State.
For example, a sample record in the file is:
['Andhra Pradesh','Amaravati',52221000,'Telugu']Write a Python program which reads the data from this file and appends all those records where population is more than 10000000 into another csv file 'More.csv'.
Note: "States.csv" also contains the Header row. The Header row should NOT be copied to "More.csv".