Python Prime Number For & While Loop
wap to create a function which display the factorial of five.
def fact(n):
if n == 0:
return 1
else:
return n * fact(n - 1)
print(fact(3))
also using whileeee loopp seee this
# Factorial of 5
def fac(n):
r=1
i=1
while i<=n:
r=r*i
i+=1
return r
print(fac(3))
wap to create a function for display n number of prime Numbers.
def prime(n):
c = 0
for i in range(1, n + 1):
if n % i == 0:
c += 1
if c == 2:
print("Its a Prime")
else:
print("compo")
prime(8)
another method using while
n = int(input("Hello"))
c = 2
x = 0
while c < n:
if n % c == 0:
x = 1
break
c += 1
if x == 0:
print('prim,')
elif x == 1:
print("compo")
def prime(n):
c = 2
x = 0
while c < n:
if n % c == 0:
x = 1
break
c += 1
if x == 0:
print(n, "is prime")
else:
print(n, "Composite Number")
prime(6)
Week 1: Drones & ESP32 Overview
Topics:
What is a drone? Types and applications.
Drone components: Frame, Motors, ESCs, Battery, Flight Controller (ESP32).
What is ESP32 and why MicroPython?
Activities:
Watch real drone missions (Delivery, Rescue, Mapping).
Drone Parts Disassembly & Reassembly Demo.
Flash MicroPython to ESP32.
Write a “Hello Drone” LED Blink program.
Mini Project:
Create a Drone Anatomy Poster.
Comments
Post a Comment