Program: #Type casting #1. string to int x=input("Enter value of x:") print(x,type(x)) y=int(x) print(y,type(y)) #2...
Read More
Showing posts with label BasicPythonProgram. Show all posts
Showing posts with label BasicPythonProgram. Show all posts
5 Program that takes the marks of 5 subjects and display the grades using Python
Program: m1,m2,m3,m4,m5 = input("Enter 5 Subject Marks").split(' ') m1 = int(m1) m2 = int(m2) m3 = int(m3) m4 =...
Read More
4 Program to find out absolute value of an input number in Python
Program: num = float(input("Enter any Number:") if num < 0: print("Number: ",-num) else: print("Numb...
Read More
3 Program to check if a Number is positive, negative or zero in Python
Program: num = int(input("Enter any Number:")) if num < 0: print("Number is Negative") elif num > 0: ...
Read More
2 Program to check year is Leap Year or not in Python
Program: num = int(input("Enter any year:")) if num % 4 == 0: print(num ,"Year is Leap Year") else: pri...
Read More
1 Program to find square root of a number in Python
Program: number = int(input("Enter any number:")) sqrt = number ** 0.5 print(" Number: ",sqrt) Output:
Read More
Subscribe to:
Posts (Atom)