• +91 9723535972
  • info@interviewmaterial.com

Data Science Interview Questions and Answers

Question - How will you read a random line in a file?

Answer -

import random 
def random_line(fname): lines = open(fname).read().splitlines() 
    return random.choice(lines) print(random_line('test.txt'))

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners