I need to code a 1 22 333 4444 pattern in python with while loops

how to print 1 22 333 4444 in python
print pyramid in python using while loop
1 22 333 pattern in c
square number pattern in python
python pattern programs
alphabet pattern programs in python
inverted star pattern in python
python write a program that uses nested loops to draw this pattern

I have to do the pattern 1 22 333 4444 with while loops in python

def EXwhile6 ():
    '''This funtion prints a pattern. The user enters how many lines'''
    #Init
    a = input ("Write how many lines you want to print: ")
    a = int(a)
    K = 1
    #Condition
    while K <= a: 
        #Action
        line = str(K)
        #Update
        line2 = line + str(K)
        print (line2)
        K += 1
EXwhile6 ()

The output should be

1
22
333
4444

I tried that code and I obtain

11
22
33
44

This is the idiomatic way to do it in Python, using the fact that a string can be "multiplied":

def EXwhile6 ():
    a = input("Write how many lines you want to print: ")
    a = int(a)
    K = 1
    while K <= a:
        print(str(K) * K)
        K += 1

Now, if you want to code it by hand you'd need a nested loop; the above is equivalent to:

def EXwhile6 ():
    a = input("Write how many lines you want to print: ")
    a = int(a)
    K = 1
    while K <= a:
        J = 1
        while J <= K:
            print(K, end="")
            J += 1
        print()
        K += 1

Python Exercise: Construct the following pattern, using a nested , Python Exercises, Practice and Solution: Write a Python program to construct the following pattern, using a nested loop number. 1 22 333 4444 55555 666666 7777777 88888888 999999999 While the : -based notation is very helpful for simple slicing, the explicit use of slice() objects simplifies the  Python Conditional: Exercise - 44 with Solution. Write a Python program to construct the following pattern, using a nested loop number. Pictorial Presentation: Sample Solution: Python Code: for i in range(10): print(str(i) * i) Sample Output:

You've left out a processing step. Your loop body

    line = str(K)
    line2 = line + str(K)
    print (line2)

... specifically concatenates exactly two copies of the number, and print that out.

Instead of two copies, you need a loop that will concatenate K copies, rather than two.

Since your posted code shows that you already know how to write a loop to execute K times, I expect that you can fix it from here.

1 22 333 4444 55555 pattern printing in python, Python 3, 1 22 333 4444 55555 pattern printing in python in Python 3. n=10 for num in range(n+1): for i in range (num ): print(num,end="") print("\r")  How can I print number pyramid with for loop(not while only for) in unix like: 1 22 333 4444 55555 ----- Post updated at 09:09 AM ----- Previous update was at 09:07 AM ----- I forgot it | The UNIX and Linux Forums

You keep adding the same number (K) to your line. You need a second loop to count from 1 to K. Modify the while loop as follows:

while K <= a:
    #Action
    line = ""
    #Update
    for j in range(1, K + 1):
        line = line + str(K)
    print (line)
    K += 1

As a side note, the whole program can be written in a single line using list comprehensions and .join():

def EXwhile6 ():
    a = input ("Write how many lines you want to print: ")
    print "\n".join([str(x) * x for x in range(1, int(a) + 1)])
EXwhile6()

1 22 333 4444 55555, 1 22 333 4444 55555. by using while loop. python loops. 3rd October 2016, 10:​40 AM. Imran Gul. 6 Answers. New Answer. Sort by: Votes, Date. +1. Welcome to Technical School, In this Qbasic we will print the pattern like this 1 22 333 4444 55555 1 12 123 1234 12345 -----

Introduction to Python Programming, 22. d. raw_input() What is the output of the following code snippet? x = 'abcd' for i in x: print(i) a. abcd b. 0 1 2 3 c. iiiii d. Traceback The function of while loop is a. Repeat a chunk of Write a program to display the following pattern using nested loops. 1 1 55555 uses a while. 22 333 4444 21 321 4321 Review Questions. Introduction to Patterns in Python. In the python language, we can create the patterns by using the For Loops. Here we can manipulate them for loops and with that, we can print the statement in order to have a unique pattern such as stars, Numeric and Character pattern.

Python Interview Questions: Ultimate Guide to Success, Question: What will be the output for the following code? i = 6 while True: if i%4 == 0: + 1 Question: Write code to produce the following pattern: 1 22 333 4444​  The code I had written was going 55555 4444 333 22 1 instead of the other way around. – Dragoş Paul Marinescu Oct 15 '13 at 15:41 Looks like I caused way too much trouble with my first question :( – Dragoş Paul Marinescu Oct 15 '13 at 15:45

What is the C program for printing (1, 22, 333, 4444)?, You could also make a function where you pass a and b (1 and 5 in our example)​. You could also just have one loop with two variables. You could also have just  Python conditional statements and loops [44 exercises with solution] [An editor is available at the bottom of the page to write and execute the scripts.1. Write a Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included).