Stuck on Python programming

Solved

Hello,

This program is written in Python. It constructs a secret word in a variable, but does not display it.

tete = "" message = "the secret word is: " for num in [72 , 65 , 66 , 73 , 84]:     tete = tete + chr(num) print(message + tete)

Can you modify it to display the secret word? Can you help me?

2 answers

  1. Moderator

    Hello,

    you need to print the variable tete

    tete = "" message = "the secret word is: " for num in [72 , 65 , 66 , 73 , 84]: tete = tete + chr(num) print(message, tete)

    0
    1. I wonder where you found this code.
      Of course, if you know a bit about ASCII, you can find the codes, but I doubt that's what you did.
      Here’s how we could do it:

      secret = "..."     # I'm not giving the secret word. codes = [] for letter in secret:     codes.append(ord(letter)) print(codes)     # We will retrieve the codes given below. secret = "" message = "the secret word is: " for num in [72 , 65 , 66 , 73 , 84] :    secret += chr(num) print(message + secret)
      0