# Sample codes in Python

factorialFactorial of an input number by looping and by recursive functions
factorsFactors of an input number
Prime NumbersPrime Numbers
FibonacciFibonacci numbers by looping and by recursive functions
Sum of DigitsSum of digits of an input number
Multiplication tableMultiplication table using nested for loops
strong numberCheck input number is strong number or not
Armstrong numberCheck input number is Armstrong number or not
Digit CubesNumber equal to sum of cubes of its digits
recursionGetting and setting recursion limits
DateExercise on Date & time

### Sum of three user input numbers

int() to get Integer from String
``````a=int(input("Enter first Number"))
b=int(input("Enter second Number"))
c=int(input("Enter third Number"))
sum=a+b+c
print(sum)``````

### Enter mark to get status of your division

`````` m=int(input("Enter your marks"))
if(m>=90):
print("You have Passed with First Distinction")

else:
if(m>=60):
print("You have passed with Second Distinction")
else:
if(m>=35):
print("You have just passed work hard next time")
else:
print("Failed")``````
In place of using multiple if else , it is better to use elif.
Read more how to use elif to get the grade from input mark.

### Converting Decimal to Binary number

``````def my_binary(n):
i=''
while n>1:
a = n%2
n = n//2
i=str(a)+i
i=  str(n%2) +i
print (i)

a=my_binary(156) ``````

### round a number without using round() function

``````x=float(input("input number "))
y=int(x+0.5)
print(y)``````

Subscribe to our YouTube Channel here

## Subscribe

* indicates required
Subscribe to plus2net plus2net.com