Skip to main content
Changed it so it be more understandable
Source Link
Supercolbat
  • 351
  • 2
  • 8
  • 18

How do I do a backspace in python? I think there isI'm trying to figure out how to print a wayone line string while using \something but I don't know whata for loop. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass

Out:

Enter a number: 5
*
**
***
****
*****
Equation:
1
+
2
+
3
+
4
+
5

How do I make the equation in just one single line like this:

1+2+3+4+5

How do I do a backspace in python? I think there is a way using \something but I don't know what. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass

Out:

Enter a number: 5
*
**
***
****
*****
Equation:
1
+
2
+
3
+
4
+
5

How do I make the equation in just one single line like this:

1+2+3+4+5

I'm trying to figure out how to print a one line string while using a for loop. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass

Out:

Enter a number: 5
*
**
***
****
*****
Equation:
1
+
2
+
3
+
4
+
5

How do I make the equation in just one single line like this:

1+2+3+4+5
Whoops
Source Link
Supercolbat
  • 351
  • 2
  • 8
  • 18

How do I do a backspace in python? I think there is a way using \something but I don't know what. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass

Out:

Enter a number: 5
*
**
***
****
*****
Equation:
1
+
2
+
3
+
4
+
5

How do I make the equation in just one single line like this:

1+2+3+4+5

How do I do a backspace in python? I think there is a way using \something but I don't know what. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass

How do I do a backspace in python? I think there is a way using \something but I don't know what. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass

Out:

Enter a number: 5
*
**
***
****
*****
Equation:
1
+
2
+
3
+
4
+
5

How do I make the equation in just one single line like this:

1+2+3+4+5
Source Link
Supercolbat
  • 351
  • 2
  • 8
  • 18

How to do a backspace in python

How do I do a backspace in python? I think there is a way using \something but I don't know what. If there are other ways that you know of, I would appreciate the help. Thank you. Also, try edit off my code!

times = int(input("Enter a number: "))
print(times)
a = 0
for i in range(times+1):
    print("*"*i)
    a += i
print("Total stars: ")
print(a)
print("Equation: ")
for e in range(1,times+1):
    print(e)
    if e != times:
        print("+")
    else:
        pass