This commit is contained in:
lw-everestlinux
2022-12-13 11:38:55 -05:00
parent 19881139f2
commit 7a1383f13c
23 changed files with 94 additions and 0 deletions

2
stuff/loops/num1.py Normal file
View File

@@ -0,0 +1,2 @@
for i in range (11):
print(i, end=" ")

3
stuff/loops/num10.py Normal file
View File

@@ -0,0 +1,3 @@
num = int(input("Enter a number: "))
print(str(num)[::-1])

4
stuff/loops/num2.py Normal file
View File

@@ -0,0 +1,4 @@
n = int(input("Enter a number: "))
b = sum(range(1, n+1))
print(b)

5
stuff/loops/num3.py Normal file
View File

@@ -0,0 +1,5 @@
a = int(input("Enter a number: "))
c = 1
while (c <= 10):
print(a * c)
c += 1

7
stuff/loops/num4.py Normal file
View File

@@ -0,0 +1,7 @@
a = int(input("Enter a number: "))
b = a * 5
c = b % 2
if (c != 0):
print("Not divisible by 5")
else:
print("Divisible by 5")

7
stuff/loops/num5.py Normal file
View File

@@ -0,0 +1,7 @@
a = int(input("Enter a number: "))
count = 0
while (a > 0):
count = count + 1
a = a // 10
print(count)

2
stuff/loops/num6.py Normal file
View File

@@ -0,0 +1,2 @@
for i in range(-10,0):
print(i, end=" ")

9
stuff/loops/num7.py Normal file
View File

@@ -0,0 +1,9 @@
tg = int(input("Enter a number: "))
for number in range(1,tg+1):
if number > 1:
for i in range(2, number):
if (number%i) == 0:
break
else:
print(number)

11
stuff/loops/num8.py Normal file
View File

@@ -0,0 +1,11 @@
a = 100
n1, n2 = 0, 1
count = 0
while count < a:
print(n1)
nth = n1 + n2
n1 = n2
n2 = nth
count += 1

5
stuff/loops/num9.py Normal file
View File

@@ -0,0 +1,5 @@
import math
a = int(input("Enter a number: "))
b = math.factorial(a)
print(b)