PYTHON PROGRAM TO READ AN INTEGER AND PRINT THE SAME

Опубликовано: 29 Октябрь 2024
на канале: PRINCE OF PROGRAMMING
78
like

Welcome to my channel Prince of Programming👨‍🎓

   / @princeofprogramming  

This tutorial will give you a full introduction into the PYTHON PROGRAM TO READ AN INTEGER AND PRINT THE SAME

   • PYTHON PROGRAM TO READ AN INTEGER AND...  

Give this video a thumps up👍

Share & subscribe for more videos😏

Show your support to recover the channel❤

Click the bell icon to get notified for new videos🔔

Feel free to drop your doubts in the comment section📗

TOPIC - PYTHON PROGRAM TO READ AN INTEGER AND PRINT THE SAME

   • PYTHON PROGRAM TO READ AN INTEGER AND...  

*) Comment starts with a # symbol and Python will ignore them.

*) Example: #Python program to read an integer and print the same

*) The Python input( ) method is often used to allow user input.

*) The input( ) method reads a line from input, converts into a
string and returns it.

*) Syntax :
input( )
input(‘A string representing a default message before the input.’)

*) Whatever you enter as input, input( ) function convert it into a string.

*) If you enter an integer value still input( ) function convert it into a string.

*) You need to explicitly convert it into an integer in your code using typecasting.

*) In Python int( ) method can construct an integer number from a string literal.

*) Syntax : int(input(“prompt string”))
int(input(“Enter a number”))
variable_name = int( input ( “prompt string” ) )

*) The Python print( ) statement is often used to print any text.

*) Syntax :
print text
or
print(text)

*) To print any text in python, the entire text must be represented within single quotes or double quotes.
print “text”
or
print ‘text’
or
print(“text”)
or
print(‘text’)

#PYTHON #PYTHON_PROGRAMMING #INTEGER