I have to write 2 triangles in one raw (python)

+1 vote
I have two triangles that has to be in the same raw, both of them are made with the same code:

n = 5

for k in range(n):

for j in range(n):

print('x' if j+k >= n-1 else '', end='')

print()

they have little changes in the 4th line but exept that they are the same. I need to make them to be on the line like this:

x                     x
xx                 xx
xxx              xxx
xxxx           xxxx

help?
Dec 3, 2019 in Python by מיקה
• 130 points
205 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

How do I append one string to another in Python?

If you only have one reference to ...READ MORE

answered Oct 22, 2018 in Python by SDeb
• 13,250 points
93 views
0 votes
1 answer

I have a dictonary in python how to access the value field?

dic={"car":["limo","sedan"]} print (dic.keys())    <-----------------------Fetch the key "car" print (dic['car'][0])   <------------------------Fetch ...READ MORE

answered Dec 19, 2018 in Python by Shuvodip
119 views
0 votes
1 answer

How can I write code to find a palindrome in python without using string functions?

In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)): In ...READ MORE

answered Jan 16, 2019 in Python by charlie_brown
• 7,780 points
7,153 views
0 votes
1 answer

How can I write a program to add two numbers using functions in python?

def add(a,b):      return a + b #when i call ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,210 points
6,282 views
0 votes
4 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,180 views
0 votes
0 answers
+4 votes
6 answers