Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1b77631

Browse files
author
Roman Mitch
committedJul 27, 2021
add files from class
1 parent 0efc769 commit 1b77631

File tree

6 files changed

+69
-1
lines changed

6 files changed

+69
-1
lines changed
 

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# pythonExamples
1+
# python examples from class

‎circleCalc.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# write a function that calculates the area of a circle
2+
# given the radius
3+
4+
# here' is the function
5+
def circleArea(radius):
6+
area = 3.14 * radius ** 2
7+
return area
8+
9+
inner_circle = circleArea(5)
10+
outer_circle = circleArea(10)
11+
12+
# here i am calculating the area of the ring
13+
ring_area = outer_circle - inner_circle
14+
15+
print("The area of the inner circle is", inner_circle)
16+
print("the area of the outer circle is", outer_circle)
17+
print("The area of the ring is", ring_area)

‎goSomewhere.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# write some instructions for putting a kid in the car
3+
4+
# get the name of the child
5+
kid = input("What's the name of your child? ")
6+
7+
# put the kid in the carseat
8+
print(f"put {kid} in the carseat")
9+

‎quadratic.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# a*(b%c)
2+
# a*b%c
3+
4+
a = 10
5+
b = 20
6+
c = 30
7+
8+
print(a*(b%c))
9+
print(a*b%c)
10+
11+
def quadraticOne(a, b, c):
12+
return a*(b%c)
13+
14+
def quadraticTwo(a, b, c):
15+
return a*b%c
16+
17+
# test if the return value of quardraticOne is the same as the return value of quadraticTwo
18+
print(quadraticOne(a, b, c) == quadraticTwo(a, b, c))
19+

‎studentMarks.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# print students marks
2+
3+
student_name = input("Enter student name: ")
4+
5+
student_marks = 78
6+
print(f"{student_name}'s marks are: ", student_marks)
7+
8+
student_name = input("Enter student name: ")
9+
10+
student_marks = 95
11+
print(f"{student_name}'s marks are: ", student_marks)
12+
13+
# stu_mark = 28
14+
# print("AB's marks are: ", potatoes)

‎test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# get the users name
2+
name = input("What is your name? ")
3+
4+
# greet the user
5+
6+
encouragement = 'You can do it!' * 100
7+
8+
greeting = f'Hello {name}, {encouragement}'
9+
print(encouragement)

0 commit comments

Comments
 (0)
Please sign in to comment.