You could just ignore the error data by try.. except.

self is not good name for regular parameter as it is normally used in oo programs for the instance itself.

Tony

rproffitt commented: Good idea about the "self" variable. +8

You have here very complete algorithm, but you should show effort of implementing it, even if you do not get everything right. After we can assist you in debugging or point weak points to concentrate in.

You have tagged various programming languages, but I do not get really your point, can you give specific question or your problem. Anything showing were you are stuck and we could advice you.

Yes, you must just make the number split from file line numeric and check if that line had line_value in it if it is lower than current line_value, as you seem to have line_value always increasing and the lines with second value higher do not need checked. You might add all numbers from the line in set for this check, maybe list of sets.

You have very similar lines in your code, it would better to use loop over the list from third value to end (con[2:]).

I would not use input as a variable name, especially as you also try to use also the function input, which is hidden due to this.

Did this solve your problem? If so, please mark it as solved.

Here is bit more advanced version when you start to internalize the Python philosophy:

# Lets make it run with Python2
from __future__ import print_function

try:
    input = raw_input
except:
    pass

def acronym(phrase):
    return ''.join(word[0] for word in phrase.upper().split())

def main():
    print("This program creates an acronym for a phrase")
    print("entered by the user.")
    print(acronym(input("Please enter your phrase: ")))

main()

Vegaseat:
Bit more interesting content decorator:

def print_it(func):
    def inner(*args):
        print(' '.join(func()))
        return func
    return inner

@print_it
def my_func():
    return "Hello", "World"

my_func()

Would we need New Hopefulls forum?

You did not ask anything and this is not functional prrogram, what is your reason for posting it?

You forget to state your problem or question.

Considering your mathematical background, if you need some exercises after you got the basics and before tackling recoding your old code to Python (nice and very recommendable own project to push you to learn more), you might want to go through mathematical coding chalenges of the Project Euler

I am just youngster, started with MSBasic, Z80 Assembler and (Turbo) Pascal at 80's :)

I changed the snippet to code snippet and added call to main.

I think it is easy to choose subset of unicode letters (one special language specific letter from each letter set from each language specific letter set and special symbol set, for example, upto 256 set), that are unlikely to all occur in same document. And If you have one letter that does not occur in file, all sequences including that letter are not included in file, if you want longer non-occuring string.

Gribouillis commented: Yes but how to write it down ? +14

How about hashing the letters in file, generate random letters until random letter hits empty slot in hash. If there is enough empty slots in hash, it should not take too many guesses. And guess + hash + check is quite fast operation. This, if you want to find unicode letter not used in file. With some very simple hash function (maybe simple mod n, not, but something slightly more complex) it might be able to limit guesses in subset of unicode letters based on the index of empty hash slot.

For longer n-length string, it should be quite easy to find unicode letter very unlikely to appear more than n times in the file. Then you just make sure that for hit h, letter h in string generated differs from letter h letters after hit h. You could also record one letter after each hit. There should be many holes in unicode letters, as the hits should not be many. And available unicode choices are many for the second letter of not-matching string. If the rare letter is not found in file is of course trivial and should be dominant case for average running time of the algorithm.

Please start a new thread for your question instead. If the file is not too long you can just read it in and use the replace method of strings to replace comma with nothing. That would not allow any commas inside the data.

Here is example of minimum function with iterable and function to calculate distance:

from math import hypot
from functools import partial

def distance(p1, p2):
    return hypot(p2[1] - p1[1], p2[0] - p1[0])

points = [(81,3), (34, 32), (-4, 6)]

reference = (10,23)

print(min(points, key=partial(distance, reference)))
Gribouillis commented: I didn't know hypot() ! +14

Use list comprehension/generator with min-function.

Here is my code changed to produce text mode banner effect by os independent way of printing empty lines for clearing the screen. This method suprizingly seems to work better for IDLE window than terminal (console) screen/window.

# -*- coding: cp1252 -*-
from __future__ import print_function
import time
try:
    from itertools import izip_longest
except ImportError:
    # Python 3
    from itertools import zip_longest as izip_longest

def rot_right(a, fillvalue=None):
    return list(izip_longest(*a[::-1], fillvalue=fillvalue))

hello = dict(zip('helowrd'.upper(),'''

 *  *
 *  *
 ****
 *  *
 *  *
§

 ****
 *
 ****
 *
 ****
§

 *
 *
 *
 *
 ****
§

  ***
 *   *
 *   *
 *   *
  ***
§

*  *  *
*  *  *
*  *  *
*  *  *
 *  *
§

 * *  
 *  *
 ***
 *  *
 *   *
§

 ***
 *  *
 *  *
 *  *
 ***
'''.split('\n§')))

hello[' '] = 5 * '     \n'
spacing = 10
# at least lines per terminal minus banner hight
# or less for multibanner effect
much = 25 - 6
banner_length = 80
banner = ['' for line in range(8)]
for c in 'Hello world'.upper():
    print(c)
    for n, line in enumerate(hello[c].split('\n')):
        print(n,line)
        banner[n] += line.ljust(spacing)
    n += 1
    while n < len(banner):
        banner[n] += ' '.ljust(spacing)
        n += 1

for rot in range(480):
    rot = rot % banner_length
    time.sleep(0.1)
    print('\n' * much) # system independant emptying of screen
    print('\n'.join((b[rot:] + spacing*' ' + b[:rot])[:banner_length] for b in banner))

I think in Python3 it is called zip_longest. I updated my code in original post.

Hi, double newlines seemed to work in Windows, but rotating the text turned out to be little more involved than I thought. I even had to revise my earlier rotation code to use izip_longest to deal with not square rotation of the character matrix.

try:
    from itertools import izip_longest
except ImportError:
    # Python 3
    from itertools import zip_longest as izip_longest

def rot_right(a, fillvalue=None):
    return list(izip_longest(*a[::-1], fillvalue=fillvalue))

hello = dict(zip('helowrd'.upper(),'''
 *  *
 *  *
 ****
 *  *
 *  *
§
 ****
 *
 ****
 *
 ****
§
 *
 *
 *
 *
 ****
§
  ***
 *   *
 *   *
 *   *
  ***
§
*  *  *
*  *  *
*  *  *
 *  *
§
 ****
 *   *
 *  *
 ***
 *  *
 *   *
§
 ***
 *  *
 *  *
 *  *
 ***
'''.split('\n§')))

hello[' '] = 5 * '     \n'
print('\n\n'.join(hello[c] for c in 'Hello world'.upper()))

print('Rotated:')
for c in 'Hello world'.upper():
    print('\n'.join(''.join(data)
                    for data in rot_right(hello[c].split('\n'),
                                          fillvalue=' ')
                    ))

IDLE does not like lines only space characters, so here safer version that works.

hello = dict(zip('helowrd'.upper(),'''
 *  *
 *  *
 ****
 *  *
 *  *

 ****
 *
 ****
 *
 ****

 *
 *
 *
 *
 ****

  ***
 *   *
 *   *
 *   *
  ***

*  *  *
*  *  *
*  *  *
 *  *

 ****
 *   *
 *  *
 ***
 *  *
 *   *

 ***
 *  *
 *  *
 *  *
 ***
'''.split('\n\n')))

hello[' '] = 5 * '\n'
print('\n\n'.join(hello[c] for c in 'Hello world'.upper()))

Here little bigger version

hello = dict(zip('helo wrd'.upper(),'''
 *  *
 *  *
 ****
 *  *
 *  *

 ****
 *
 ****
 *
 ****

 *
 *
 *
 *
 ****

  ***
 *   *
 *   *
 *   *
  ***

*  *  *
*  *  *
*  *  *
 *  *

 ****
 *   *
 *  *
 ***
 *  *
 *   *

 ***
 *  *
 *  *
 *  *
 ***
'''.split('\n\n')))

print('\n\n'.join(hello[c] for c in 'Hello world'.upper()))

print("Hello World")

Can anybody print out "Hello World" vertically?

print('\n'.join("Hello World"))

am bit bzlld

I think you are still here:

Show the
iterative development of the individual solutions with suitable testing throughout the process. Test
the final products and evaluate your solutions against the detailed requirements you identified in the
analysis.

I see no indication that this is the case i.e. that your program fulfills the requirements and of your testing methodology.

The last post was not tested on Python3, so here is the working version for both:

from __future__ import print_function
try:
    input = raw_input
except:
    pass

import random

def exercises(count, perline=3, width=80):
    print((width * '=').join('\n\n'))
    w = width // perline
    for i in range(count):
        if not i % perline:
            print('\n\n')
        a = random.randint(1,9)
        b = random.randint(1,9)
        c = a * b
        case = random.randint(0,5)

        if case == 0:
            ex = '%2i / %2i = ______'.ljust(w) % (c, a)
        elif case == 1:
            ex = '%2i * %2i = ______'.ljust(w) % (a, b)
        elif case == 2:
            ex = '%2i * ______ = %2i'.ljust(w) % (a, c)

        elif case == 3:
            ex = '%2i / ______ = %2i'.ljust(w) % (c, b)
        elif case == 4:
            ex = '______  / %2i = %2i'.ljust(w) % (a, b)           
        else:
            ex = '______  * %2i = %2i'.ljust(w) % (a, c)
        print(ex, end= '')
    print()    
    print((width * '=').join('\n\n'))

exercises(int(input('How many exercises? ')))
from ScrolledText import *
from Tkinter import *

main = Tk()
mywin = ScrolledText(main)
mywin.pack(fill=BOTH, expand=YES)

main.title('Favorite Movies')
favorite_movies = [
"Gone with the Wind",
"Batman IV",
"Spiderman VII",
"Sniper III"]
mywin.insert(END,'\n'.join(favorite_movies))
mywin.focus_set()
mywin.mainloop()