Dnyanrath
Dnyanrath
  • Home
  • Contact US
  • Courses
  • Media Resources
  • Points To Be Noted

Python Concepts Made Easy with code

Basic Concepts

 Basic Input/Output 

1. Input/output string (welcome name)

Code:

name = input('Enter your name')

print(“welcome ”, name)

output:

Enter your namekirti

welcome kirti 

  

2. Input/output number (square of number)

Code:

num =int(input('Enter number'))

print("square=", num*num)

output:

Enter number5

square= 25 


Conditional Statements / Branching

1. simple if and else (even/ odd)

Code:

num =int(input('Enter number'))

if num%2==0:

print(num," is even")

else:

print(num," is odd")

output:

Enter number8

8 is even 

  

2. if and else if (compare two numbers)

Code:

num1 =int(input('Enter first number'))

num2 =int(input('Enter second number'))

if num1> num2:

print(num1 ," is greatest")

elif num2> num1:

print(num2 ," is greatest")

else:

print(num1,"is same as",num2)

output:

Enter first number20

Enter second number15

20 is greatest 

Poem On Python Programming

Copyright © 2025 dnyanrath - All Rights Reserved.

  • Courses
  • Media Resources
  • Points To Be Noted

Powered by