forked from nekokaito/python-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask1.py
More file actions
69 lines (39 loc) · 944 Bytes
/
Task1.py
File metadata and controls
69 lines (39 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Print numbers 1 to 10 using a loop.
# Print even numbers from 1 to 100.
# Print all characters of a given string.
# Calculate the sum of all numbers from 1 to N (input).
# Print the multiplication table of a given number (e.g., 5).
# Reverse a given string using a loop.
# Count the number of vowels in a string.
# Find the factorial of a number using a loop.
# Print all elements of a list.
# Print only the positive numbers from a list.
#Task 1
for i in range(1,11):
print(i)
#Task 2
for i in range(1,101):
i%2 == 0 and print(i)
#Task 3
y = "Kaito"
for i in y:
print(i)
#Task 4
n = 51
sum = 0
for i in range(n):
sum = sum+i
print(sum)
#Task 5
h = 5
for i in range(1,11):
print(f"{h} x {i} = {h*i}")
#Task 6
lm = "Nikkaa"
sm = ""
for i in range(len(lm)):
sm = lm[len(lm) - 1 - i]
print(sm, end="")
# Another Way
for i in reversed(lm):
print(i)