Computer Science, asked by sisindhar1611, 11 months ago

Write the Python program to display your name

Answers

Answered by shivangsaraswat
0

Answer:

mark me as branliest please

Explanation:

# Python program to prints your name upon execution

import sys

  

def main():

    program = sys.argv[0] # argv[0] contains the full path of the file

  

    # rfind() finds the last index of backslash

    # since in a file path the filename comes after the last '\'

    index = program.rfind("\\") + 1

  

    # slicing the filename out of the the file path

    program = program[index:]

    print("Program Name: % s" % program)

  

# executes main

if __name__ == "__main__":

    main()

Answered by AskewTronics
0

Python program and the output is described below for the above question:

Output:

If the user enter as "Go", then the output will be "Your name is: Go".

Explanation:

print("Your name is:  ",input("Enter your name:  ")) #input and print statement which take the input and print the value.

Code Explanation :

  • The above one-line code holds the two states the print and the input statement which is written in the python language.
  • The input statement instructs the user for the input and takes the input.
  • Then that input value is rendered by the help of print statements with instructing the name is this.

Learn more :

  • Python : https://brainly.in/question/14689905
Similar questions