Skip to content

zeroones

  • Home
  • Verilog
  • Python
  • Arduino
  • C
  • Contact

python qna

Python Program Of Calculator With Basic Functionality

11 November 2022 by zeroones.org

01. Example def calculator(A,B,N): if (N==1): return (A + B) elif(N==2): return (A – B) elif(N==3): return (A * B) elif(N==4): return (A / B) else: print("Please Enter Valid Number.") …

Read more

Python Program to Count Only Positive And Negative Number Of A List

10 November 2022 by zeroones.org

Example def checkPositiveNegative(data,length): for i in range(length): if data[i] > 0: positiveArray.append(data[i]) elif data[i] < 0: negativeArray.append(data[i]) print('Total positive values are: ',len(positiveArray)) print('Total negative values are: ',len(negativeArray)) print('Total number of …

Read more

Python Program to Check Whether the List Is Empty or Not

9 November 2022 by zeroones.org

Content 01. Using len() function 02. Using bool() function 03. Direct Method 01. Example Using len() function. def checkEmptyList(lst): if len(lst)==0: print('Empty List.') else: print('Not Empty List') list01=[] checkEmptyList(list01) Output: …

Read more

Python Program To Interchange First And Last Element In A List

8 November 2022 by zeroones.org

01. Example a = [11, 10, 98, 35, 90, 46, 20] a[0], a[-1] = a[-1], a[0] print(a) Output: [20, 10, 98, 35, 90, 46, 11] 02. Example a = [11, …

Read more

Python Program To Print All Prime Factors Of A Number Using Math Library

7 November 2022 by zeroones.org

Python Program To Print All Prime Factors Of A Number Using Math Library Example Using Math Library. import math def allPrimeFactors(number): print("All Prime Factors Of {} :".format(number)) while (number%2==0): print(2,) …

Read more

Python Program To Print Largest Prime Factors Of A Given Number

6 November 2022 by zeroones.org

Python Program To Print Largest Prime Factors Of A Given Number Example def largestPrimeFactor(number): n = number i = 2 while ((i*i) <= n): if (n%i): i+=1 else: n//=i print("Largest …

Read more

Python Program To Print Total Number Of Factors Of A Given Number

5 November 2022 by zeroones.org

Python Program To Print Total Number Of Factors Of A Given Number Example def numberOfFactors(N): counter = 2 factorsArray= [1] for i in range(2,N//2): if (N%i == 0): factorsArray.append(i) counter …

Read more

Python Program To Find Factors Of A Number Using Function

4 November 2022 by zeroones.org

There are a lot of methods in Python to find the factor or divisor of a given number and almost all the methods can be implemented using a function. Because …

Read more

Python Program To Find Factors Of A Number Using While Loop

3 November 2022 by zeroones.org

Python Program To Find Factors Of A Number Using While Loop Example def factors(x): print("Factors Of {}:".format(x)) i = 1 while(i < (x+1)): d=x%i if d==0: print(i) i+=1 n=18 # …

Read more

Python Program To Find Factors Of A Number Using Recursion

2 November 2022 by zeroones.org

Python Program To Find Factors Of A Number Using Recursion Example def factors(x,i): if(x >= i): if ((x%i)==0): print(i) factors(x,i+1) n=18 # n = int(input(“Enter Integer Value: “)) factors(n,1) Output: …

Read more

Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 … Page10 Next →

Recent Posts

  • Top 50+ Python String Functions
  • The Next-Gen PCIe 7.0: What It Means for Computing
  • Open-Source EDA Tools for VLSI Design
  • NULL and nullptr in C++
  • Developing and Testing RISC-V SystemVerilog RTL with Open-Source Tools
© 2025 zeroones, All Rights Reserved.