Hi i am new in python,i have just got a question below
A friend of yours has just bought a new computer. Until now, the most powerful computer he had
ever used was a pocket calculator. Now, looking at his new computer, he is a bit disappointed,
because he liked the LC-display of his calculator so much. So you decide to write a program
that displays numbers in an LCD-like style on his computer.
Input
The input file contains several lines, one for each number to be displayed. Each line contains two
integers s and n ( 1 ≤ s ≤ 10, 0 ≤ n ≤ 99 999 999), where n is the number to be displayed and s
is the size in which it shall be displayed. The input file will be terminated by a line containing
two zeros. This line should not be processed.
Output
Output the numbers given in the input file in an LCD-style using s ‘-’ signs for the horizontal
segments and s ‘—’ signs for the vertical ones. Each digit occupies exactly s+2 columns and
2s+3 rows. (Be sure to fill all the white space occupied by the digits with blanks including the
last one.) There has to be exactly one column of blanks between two digits. Output a blank
line after each number.
Sample Input:
2 12345
3 67890
0 0
Here is my code for one input but it gives me something else

n=raw_input()
n=n.split(' ')
s=int(n[0])
i=0
for i in n[1]:
	p=int(i)
	if(p==1 or p==4):
		print ' '*s,
	elif(p==2 or p==3 or p==5 or p==6 or p==7 or p==8 or p==9 or p==0):
		print '-'*s
for i in n[1]:
	p=int(i)
	if(p==1 or p==2 or p==3 or p==7):
		while(i<s):
			print ' '*(s-1),'|'
			i+=1
		i=0
	elif(p==5 or p==6):
		while(i<s):
			print ' |'
			i+=1
		i=0
	else:
		while(i<p):
			print ' |',' '*(s-1),'|'
			i+=1
	i=0
for i in n[1]:
	p=int(i)
	if(p==1 or p==0):
		print ' '*s
	else:
		print ' -'*s
for i in n[1]:
	p=int(i)
	if(p==1 or p==7 or p==3 or p==4 or p==5 or p==9):
		while(i<s):
			print ' '*s,'|'
			i+=1
		i=0
	else:
		while(i<p):
			print ' |',' '*(s-1),'|'
			i+=1
	i=0
for i in n[1]:
	p=int(i)
	if(p==1 or p==4):
		print ' '*s,
	elif(p==2 or p==3 or p==5 or p==6 or p==7 or p==8 or p==9 or p==0):
		print '-'*s

Note:
Do yourself and others a favor and don't use tabs for indentations, use the usual 4 spaces instead. We have discussed that plenty of times here on the forum, there are distinct benefits.

Please be more descriptive with your thread's title. It gets a little confusing with two of the same titles.

Sorry amount of red, but your code has really many problems. I did take out the tabs also by untabify, width=4.

My comments: Strange assignments to for loop variable containing the digits of number, which you are drawing.

n="2 12345" ## lets work out the example input first

n=n.split(' ') ## n=['2','12345']

s=int(n[0])  ## s=int('2') = 2

i=0 ## this number will be immidiately overwriten in next line

## top line of the numbers
for i in n[1]: ## i in ['12345']
    p=int(i)
    if(p==1 or p==4):
        print ' '*s,
    elif(p==2 or p==3 or p==5 or p==6 or p==7 or p==8 or p==9 or p==0):
        print '-'*s

## second segment of numbers
for i in n[1]: ## again i= second number, i='0'
    p=int(i)
    if(p==1 or p==2 or p==3 or p==7):
        while(i<s):
            print ' '*(s-1),'|'
            i+=1 ## never should make assignment to for loop variable !!!
        i=0 ## never should make assignment to for loop variable !!!
    elif(p==5 or p==6):
        while(i<s):
            print ' |'
            i+=1 ## never should make assignment to loop variable !!!
        i=0 ## never should make assignment to for loop variable !!!
    else:
        while(i<p):
            print ' |',' '*(s-1),'|'
            i+=1
    i=0 ## never should make assignment to for loop variable !!!

## third segment of numbers
for i in n[1]: 
    p=int(i)
    if(p==1 or p==0):
        print ' '*s
    else:
        print ' -'*s

## fourth segment of numbers
for i in n[1]: 
    p=int(i)
    if(p==1 or p==7 or p==3 or p==4 or p==5 or p==9):
        while(i<s):
            print ' '*s,'|'
            i+=1
        i=0
    else:
        while(i<p):
            print ' |',' '*(s-1),'|'
            i+=1
    i=0 ## never should make assignment to for loop variable !!!

## fifth segment
for i in n[1]:
    p=int(i)
    if(p==1 or p==4):
        print ' '*s,
    elif(p==2 or p==3 or p==5 or p==6 or p==7 or p==8 or p==9 or p==0):
        print '-'*s

The loops have assignment to loop variables. I tried to make by hand one example output, but could not match the requirements. What I missed?

## give this result for sample input of 2 12345
## -> Each digit occupies exactly s+2 columns and 2s+3 rows
## --> Each digit occupies exactly 4 columns and 7 rows
##  But I get 4 columns wide and 5 rows high, space between numbers not included
## By hand output for this sample input:
"""
     __  __        __
  |    |   | |  | |
  |  __| __| |__| |__
  | |      |    |    |
  | |__  __|    |  __|
"""
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.