Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some Code For a program
#1
# INPUT WORD & CHARACTER LENGTH VARIABLES
x = input("Insert Any Word: ")
y = len(x)
# .FORMAT VARIABLES
numPrompt = "Number Of Characters: "
clean = "Backwards Spelling of word: "
clean2 = "This word is a palendrome."
# PRINTS NUMBER OF CHARACTERS
print("Number of characters: {0}".format(y))
txt = "{0}".format(clean) +x[::-1]
# PRINTS BACKWARDS VALUE OF X
print(txt)
# PALENDROME STATUS
if x in txt:
  pal1 = "Palendrome: No"
  pal2 = "Palendrome: Yes"
  pal3 = "Palendrome: Unknown"
  print()
  print("Palendrome: Yes")
else:
  print()
  print("{0}".format(pal1))
# ERROR CHECKER
if (y==[]):
  error = "ERROR!"
  print(error)
# GLOBAL VARIABLES
global error
global pal1
global pal2
global pal3
Reply
#2
Do you have a problem with the code that you need help with?
Reply
#3
Is something like this what you're looking for?

# INPUT WORD
x = input ("Insert Any Word : ")

# PRINTS NUMBER OF CHARACTERS
print(f"Number of characters: {len (x)}")

# PRINTS BACKWARDS VALUE OF X
b = x [::-1]
print (f"Backwards its' : {b}.")

# PALENDROME STATUS
if b == x : p = 'is'
else : p = 'is not'
print (f"This word {p} a palendrome.")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Modify code from running program ? samuelbachorik 2 2,406 Jun-26-2020, 08:17 PM
Last Post: samuelbachorik
  program exited with code: -1073740791 RegiMental 2 5,133 Dec-18-2019, 01:35 AM
Last Post: Clunk_Head
  How ad key unlocker program to code? storzo 8 3,438 Sep-04-2019, 11:55 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020