Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Search results

  1. G

    Python Longest substring in a string

    Hello, I have the following assignment: ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '' ' ' '' ' ' ' Assume s is a string of lower case characters. Write a program that prints the longest substring of s in which the letters...
  2. G

    Python Doubt about recursion

    Hello, I have a doubt about how the following recursion works: ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ def fact(n): if n==1: return 1 else: return n*fact(n-1) print(fact(4)) ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ The output is 24, which...
  3. G

    Python Problem with split() and rstrip()

    Hello, I have the following assignment: Open the file **mbox-short.txt** and read it line by line. When you find a line that starts with 'From ' like the following line: From [email protected] Sat Jan 5 09:14:16 2008 You will parse the From line using split() and print out the second...
  4. G

    Python Adding brackets to a list and sort it

    Hello, I have the following assignment: Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() method. The program should build a list of words. For each word on each line check to see if the word is already in the list and if not...
Back
Top Bottom