Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Write a Python program to print an integer

Posted on October 1, 2019October 1, 2019

Table of Contents

  • Write a Python program to print an integer
    • Python program to print an integer
    • Python program to print an integer(Entered by user)
    • Related

Write a Python program to print an integer

problem – How to write a program to print an integer in Python?

In this tutorial, we discuss the simple concept of Write a Python program to print an integer

Write a Python program to print an integer
input – output

In this article, we are going to learn How to write a program to print an integer in Python language

The following shows two different ways to How to write a program to print an integer and there is an example given to each

The first Example is done by declared and initialized variable

the second Example is done through the user entered the value of the variable

Python program to print an integer

Program 1

#print an integer in Python
value=50;  #initilization of variable value
print("The integer value is ",value)  #Didplay the variable value

When the above code is executed it produces the following output

The integer value is  50

In this program,

  • Integer variable num is declared
  • Integer variable num is initialized
  • Then, the program has Displayed the output (value of variable num ) using  print() function

Python program to print an integer(Entered by user)

Program 2

#print an integer in Python
value=int(input("Enter a integer number: "));
#Ask input from your 
print("you enterd",value)  #Didplay the variable value

When the above code is executed it produces the following output

Enter a integer number: 100
you entered 100

Method

  1. The program requires input from the user
  2. Then the user enters the input value
  3. The program will read the input using input() function and stores the num variable
  4. Then, the program Display the value which  is in variable num using print() function

Similar post

Write a C++ program to print an integer

Write a Java program to print an integer

Write a C program to print an integer

 

Suggested post

Operator Python language

Hello world program in Python language

Data type in Python language

 

 

 

Related

Recent Posts

  • Multiply two numbers in Java using scanner| 5 different ways
  • 5 different ways to Divide two numbers in Java using scanner
  • Learn 8 Ways to Subtract Two Numbers Using Methods in Java
  • 10 ways to subtract two numbers in Java
  • Java Code Examples – Multiply Two Numbers in 5 Easy Ways
  • How to Divide two numbers in Java| 5 different ways

tag

Addition (8) Array (38) C++ language (91) C language (98) c sharp (23) Division (8) Function (29) if else (32) Java language (108) JavaScript (5) loops (138) Multiply (8) Oop (2) patterns (66) PHP (13) Python Language (38) Subtraction (9) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2026 Code for Java c | Powered by SuperbThemes