Python Assignment 7
Python Assignment 7
Pavan Dange
#Q1
def factorial(n):
if n == 0 or n == 1:
return 1
else:
return n * factorial(n - 1)
result = factorial(number)
#2
for i in range(11):
if i in [3, 5, 7]:
continue
print(i)
#Q3
for i in range(11):
if i in [3, 5, 7]:
continue
print(i)
#Q4
for i in range(-10, 0):
print(i)
print("Successfully Done")
#Q5
def is_prime(n):
if n <= 1:
return False
if n % i == 0:
return False
return True
if is_prime(num):
print(num)
#Q6
if a == b == c:
elif a == b or b == c or c == a:
else:
print("The triangle is Scalene")
#Q7
if a == b == c:
elif a == b or b == c or c == a:
else:
#Q8
str_upper = user_input.upper()
str_lower = user_input.lower()
print("Uppercase:", str_upper)
print("Lowercase:", str_lower)
#9
#10
print(f"Letters: {letters}")
print(f"Digits: {digits}")
print(f"Symbols: {symbols}")
Output:
Enter a number: 7
10
1
2
10
-10
-9
-8
-7
-6
-5
-4
-3
-2
-1
Successfully Done
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
Uppercase: BVB
Lowercase: bvb
Letters: 4
Digits: 0
Symbols: 0
11111
2222
333
44
55555
5555
555
55
012345
01234
0123
012
01
333
55555
7777777
999999999
24
369
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
$$$$$$$$$$$$
$$$$$ $$$$$
$$$$ $$$$
$$$ $$$
$$ $$
$ $
**
***
****
*****
****
***
**