Skip to content

Commit 77ef733

Browse files
committed
Added some basic code
1 parent 26703d9 commit 77ef733

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

nestedConds.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@
1212
print('Divisible by 2 and not by 3')
1313
elif x%3 == 0:
1414
print('Divisible by 3 and not by 2')
15+
16+
17+
18+
# creating a calculator in python using switch statements and function
19+

operators.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# simple area of triangle circle and square
2+
3+
# area of triangle
4+
def area_triangle(base, height):
5+
return 1/2 * base * height
6+
7+
# area of circle
8+
def area_circle(radius):
9+
return 3.14 * radius ** 2
10+
11+
# area of square
12+
def area_square(side):
13+
return side ** 2
14+
15+
# area of rectangle
16+
def area_rectangle(length, width):
17+
return length * width
18+
19+
# area of parallelogram
20+
def area_parallelogram(base, height):
21+
return base * height
22+

prob1.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# string_input=input("Enter a string: ")
2+
# for i in string_input:
3+
# if string_input[i] == 'a' or string_input[i]=='e' or string_input[i] == 'i' or string_input[i] == 'o' or string_input[i] == 'u':
4+
# count += 1
5+
# print("Number of vowels: " , count)
6+
7+
8+
string_input = input("Enter a string: ")
9+
count = 0
10+
for i in string_input:
11+
if i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u':
12+
count += 1
13+
print("Number of vowels: " , count)
14+
15+
16+
for i in range:
17+
for j in range:
18+
for k in range :
19+
print(i,j,k)
20+
21+
# whats object in python explain with example
22+
23+

0 commit comments

Comments
 (0)