Share your repls and programming experiences

← Back to all posts
Is this string a palindrome?
PilotDevKarwa (12)

Use this code to see if anything is a palindrome or not!

USE THIS CODE FOR ANYTHING, EVEN NUMBERS!

Comments
hotnewtop
Brendan23 (139)

@PilotDevKarwa yet another suggestion is for loading you can use :

import sys 
from time import sleep
import os
def load(rotations, delay):
  global dots
  global text_before
  global dot_num
  text_before = "Loading"
  dot_num = 0
  dots = ['', '.', '..', '...']
  for i in range(rotations):
    print(text_before, end = ""),
    sys.stdout.write(dots[dot_num])
    sys.stdout.flush()
    sleep(delay)
    dot_num+=1
    if dot_num == 4:
      dot_num-=4
      os.system('clear')
    else:
      os.system('clear')

then you can just do load(any_ineger, any_ineger). p.s. any_integer is just a place holder for a number.

PilotDevKarwa (12)

@Brendan23 That seems very complicated tho

Brendan23 (139)

@PilotDevKarwa yeah. it's pretty complicated. don't use it actually.

Brendan23 (139)

@PilotDevKarwa instead of doing left = left + 1 you can do left+=1 . It's way easier.

Brendan23 (139)

@Brendan23 also, instead of doing print("") you can do a \n inside a print statement, for example:

print("hi\nhi") 

this would print

hi
hi