GCD & LCM | Greatest common divisor (GCD) & Lowest Common Multiple (LCM). |
factorial | Factorial of an input number by looping and by recursive functions |
factors | Factors of an input number |
Prime Numbers | Prime Numbers |
Fibonacci | Fibonacci numbers by looping and by recursive functions |
Sum of Digits | Sum of digits of an input number |
Multiplication table | Multiplication table using nested for loops |
strong number | Check input number is strong number or not |
Armstrong number | Check input number is Armstrong number or not |
Digit Cubes | Number equal to sum of cubes of its digits |
recursion | Getting and setting recursion limits |
Date | Exercise on Date & time |
Salary | Employee Salary calculation |
a=int(input("Enter first Number"))
b=int(input("Enter second Number"))
c=int(input("Enter third Number"))
sum=a+b+c
print(sum)
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. 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)
x=float(input("input number "))
y=int(x+0.5)
print(y)
import urllib.request, json
key='YOUR_API_KEY' # Use your API key here
x = "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url="
x= x + 'https://www.plus2net.com/python/pdf-grid.php'
x= x + '&strategy=desktop' # other value is mobile
x= x + '&locale=en'
x= x + '&key='+key
response = urllib.request.urlopen(x)
data = json.loads(response.read()) # get the return Json data
score = data["lighthouseResult"]["categories"]["performance"]["score"]
print(score)
fcp = data["loadingExperience"]["metrics"]["FIRST_CONTENTFUL_PAINT_MS"]["percentile"]
fid = data["loadingExperience"]["metrics"]["FIRST_INPUT_DELAY_MS"]["percentile"]
lcp = data["loadingExperience"]["metrics"]["LARGEST_CONTENTFUL_PAINT_MS"]["percentile"]
cls = data["loadingExperience"]["metrics"]["CUMULATIVE_LAYOUT_SHIFT_SCORE"]["percentile"]/100
print('fcp:',fcp,'fid: ',fid,'lcp:',lcp,'cls:',cls)
Learn Python basics through ONLINE classes
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.