Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lesson03homework-2 #5

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9c2ddb9
Main
jandoniec Oct 9, 2022
a764c43
e
jandoniec Oct 9, 2022
cdc05f4
test
jandoniec Oct 9, 2022
5e47d78
Merge pull request #1 from jandoniec/main
jandoniec Oct 9, 2022
59c953e
Merge pull request #1 from jandoniec/main
jandoniec Oct 10, 2022
8edf800
Merge pull request #1 from jandoniec/main
jandoniec Oct 10, 2022
cbba2ba
Merge pull request #2 from jandoniec/main
jandoniec Oct 10, 2022
5343791
after class
jandoniec Oct 12, 2022
0d00cd5
homework
jandoniec Oct 16, 2022
10ad471
lesson03
jandoniec Oct 17, 2022
d09fc74
lesson03homework
jandoniec Oct 18, 2022
e80f18e
lesson03homework-2
jandoniec Oct 19, 2022
5e8063d
lesson03homework-2
jandoniec Oct 19, 2022
d1a6303
lesson03homework-2
jandoniec Oct 19, 2022
03829f6
Merge branch 'stalj:master' into master
jandoniec Nov 10, 2022
5e54298
lesson05homework-1
jandoniec Nov 14, 2022
b5bc2d2
lesson05homework-1
jandoniec Nov 14, 2022
c10ff4a
lesson05homework-2
jandoniec Nov 16, 2022
3c56a5c
lesson05homework-3
jandoniec Nov 19, 2022
cd77457
lesson05homework-4
jandoniec Nov 20, 2022
6912b31
lesson06
jandoniec Nov 20, 2022
2e98a67
lesson07-homework
jandoniec Nov 21, 2022
9d93d3d
lesson07-homework2
jandoniec Nov 23, 2022
457ad71
lesson07-homework3
jandoniec Nov 23, 2022
ca63acb
Merge branch 'stalj:master' into master
jandoniec Nov 25, 2022
06bf2ec
lesson08
jandoniec Nov 25, 2022
57aa8ce
lesson08xtes2preps
jandoniec Nov 30, 2022
b005b99
lesson10
jandoniec Dec 12, 2022
a22169b
lesson10/11
jandoniec Dec 20, 2022
4f431e6
Delete prep1.py
jandoniec Dec 20, 2022
2bdd3b9
Żyć dobrze, żyć z własnymi wartościami, kochać ludzi, mieć przyjaciół…
jandoniec Dec 20, 2022
97e1275
Merge branch 'stalj:master' into master
jandoniec Dec 30, 2022
5e729ca
Gdybym miał powiedzieć co cenię w życiu najbardziej - powiedziałbym, …
jandoniec Jan 7, 2023
efc9bb4
Gdybym miał powiedzieć co cenię w życiu najbardziej - powiedziałbym, …
jandoniec Jan 7, 2023
7939f3c
ehhh
jandoniec Jan 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{"name":"Python: Current File","type":"python","request":"launch","program":"${file}","console":"integratedTerminal","justMyCode":true},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
Binary file added 01-CourseIntroduction/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions 01-CourseIntroduction/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added 02-TypesAndVariables/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions 02-TypesAndVariables/3_11_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
godzinypracy=float(input("Podaj dlugosc przepracowanych godzin: "))
stawkagodzinowa=float(input("Podaj stawke godzinowa: "))

if godzinypracy>40:
stawkagodzinowa=stawkagodzinowa*1.5
print("Zarobiles ", godzinypracy*stawkagodzinowa)
else:
print("Zarobiles ", godzinypracy*stawkagodzinowa)
7 changes: 7 additions & 0 deletions 02-TypesAndVariables/3_11_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
try:
godzinypracy=float(input("Podaj dlugosc przepracowanych godzin: "))
stawkagodzinowa=float(input("Podaj stawke godzinowa: "))
except ValueError:
print("Wpisz liczbę! ")


16 changes: 16 additions & 0 deletions 02-TypesAndVariables/3_11_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
wartosc=float(input("Wpisz liczbe z zakresu 0.0-1.0:"))

if wartosc<0.5:
print(2.0)
elif wartosc>=0.5 and wartosc<0.6:
print(3.0)
elif wartosc>=0.6 and wartosc<0.7:
print(3.5)
elif wartosc>=0.7 and wartosc<0.8:
print(4.0)
elif wartosc>=0.8 and wartosc<0.9:
print(4.5)
elif wartosc>=0.9 and wartosc<=1.0:
print(5.0)
elif wartosc>1.0:
print("Wartosc spoza zakresu!")
1 change: 1 addition & 0 deletions 02-TypesAndVariables/4_14_4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odp.D
1 change: 1 addition & 0 deletions 02-TypesAndVariables/4_15_5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odp.D
13 changes: 13 additions & 0 deletions 02-TypesAndVariables/4_15_6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def computepay(hours, rate):
if hours>40:
rate=rate*1.5
wage=rate*hours
else:
wage=rate*hours

print("Liczba przepracowanych godzin: ", hours)
print("Stawka godzinowa: ", rate)
print("Zarobiles ", hours*rate)


computepay(45, 10)
19 changes: 19 additions & 0 deletions 02-TypesAndVariables/4_15_7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

def computegrade(wartosc):
if wartosc<0.5:
print(2.0)
elif wartosc>=0.5 and wartosc<0.6:
print(3.0)
elif wartosc>=0.6 and wartosc<0.7:
print(3.5)
elif wartosc>=0.7 and wartosc<0.8:
print(4.0)
elif wartosc>=0.8 and wartosc<0.9:
print(4.5)
elif wartosc>=0.9 and wartosc<=1.0:
print(5.0)
elif wartosc>1.0:
print("Wartosc spoza zakresu!")


computegrade(1)
14 changes: 14 additions & 0 deletions 02-TypesAndVariables/5_9_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
liczby=[]
while True:
a = input("Wpisz liczbe: ")
try:
n = int(a)
liczby.append(n)
except ValueError:
if a == "gotowe":
break
else:
print('Liczby pisać!')
continue

print("Srednia to: ", sum(liczby)/len(liczby))
13 changes: 13 additions & 0 deletions 02-TypesAndVariables/5_9_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
liczby=[]
while True:
a = input("Wpisz liczbe: ")
try:
n = int(a)
liczby.append(n)
except ValueError:
if a == "gotowe":
break
else:
print('Liczby pisać!')
continue
print("Max value: ", max(liczby), "Min value: ", min(liczby))
3 changes: 3 additions & 0 deletions 02-TypesAndVariables/cw3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
godzinypracy=float(input("Podaj dlugosc przepracowanych godzin: "))
stawkagodzinowa=float(input("Podaj stawke godzinowa: "))
print("Zarobiles ", godzinypracy*stawkagodzinowa)
4 changes: 4 additions & 0 deletions 02-TypesAndVariables/zad10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x=int(input("Podaj liczbe nr.1: "))
y=int(input("Podaj liczbe nr.2: "))

print(x+y)
5 changes: 5 additions & 0 deletions 02-TypesAndVariables/zad11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name="Jan Doniec"
age= 18
height=175

print(f'{name}, wiek: {age}, lat: {height}')
3 changes: 3 additions & 0 deletions 02-TypesAndVariables/zad12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x=10

print("Liczba x przyjmuje wartosc: {}, a jej kwadrat to {}".format(x, x**2))
21 changes: 21 additions & 0 deletions 02-TypesAndVariables/zad13.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from math import pi


r=5
pinumber=3.14

#area with accurate pi version
P=(5**2)*pi
print(P)

#area with defined pi
P1=(5**2)*pinumber
print(P1)

#circumference with accurate pi version
C=2*pi*5
print(C)

#circumference with defined pi
C1=2*pinumber*5
print(C1)
4 changes: 4 additions & 0 deletions 02-TypesAndVariables/zad14.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tempcelcjusz=input("Podaj temperature w celcjuszach: ")
F=(int(tempcelcjusz)*9/5)+32
print(F, " °F")
print(tempcelcjusz, " °C")
4 changes: 4 additions & 0 deletions 02-TypesAndVariables/zad17.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cm=175
inches=0,394*cm
feet=0.0328*cm
print("Im 175cm tall - ", inches, "inches", feet, "feet")
7 changes: 7 additions & 0 deletions 02-TypesAndVariables/zad18.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a=int(input("Podaj dlugość boku A: "))
b=int(input("Podaj dlugość boku B: "))
c=int(input("Podaj dlugość boku C: "))
area=(a+b+c)/2
print(area)

#area of triangle with sides 3,4,5 is 6
5 changes: 5 additions & 0 deletions 02-TypesAndVariables/zad19.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
height=int(input("Enter your height in cm: "))
height=height/100
weight=int(input("Enter your weight in kg: "))
bmi=weight/height**2
print('Your BMI index is: {:.2f}'.format(bmi))
9 changes: 9 additions & 0 deletions 02-TypesAndVariables/zad20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from random import randint

wynik=0
for i in range(0,3):
x=randint(1,6)
wynik=wynik+x
#print(x)

print(wynik)
7 changes: 7 additions & 0 deletions 02-TypesAndVariables/zad21.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from random import randint
x=randint(1,6)
y=int(input("Guess the number (1-6): "))
if y==x:
print(True)
else:
print(False)
4 changes: 4 additions & 0 deletions 02-TypesAndVariables/zad22.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x=15.84
vat=(x)*23/100
print('Amount: ', x, 'ZŁ')
print('VAT 23%: {:.2f}'.format(vat), 'ZŁ')
10 changes: 10 additions & 0 deletions 02-TypesAndVariables/zad7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
n1=5
n2=1
n3=8
n4=6
n5=3
print(n1+n2+n3+n4+n5)

print(n1**2+n2**2+n3**2+n4**2+n5**2)
print(n3/5)
print(n3==n4)
7 changes: 7 additions & 0 deletions 02-TypesAndVariables/zad8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
x=7
y=34
z=0
z=x
x=y
y=z
print(x,y)
4 changes: 4 additions & 0 deletions 02-TypesAndVariables/zad9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name=input("Podaj imie: ")
surename=input("Podaj nazwisko: ")

print(name +" "+ surename)
Binary file added 03-ControlStructures/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions 03-ControlStructures/zad10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for i in range(5):
print("Practice makes perfect")
2 changes: 2 additions & 0 deletions 03-ControlStructures/zad11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for i in range(1,21):
print(i)
6 changes: 6 additions & 0 deletions 03-ControlStructures/zad12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
licznik=0
for i in range(100,151):
#print(i)
licznik=licznik+i

print(licznik)
4 changes: 4 additions & 0 deletions 03-ControlStructures/zad13.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
licznik=0
for i in range(1,11):
licznik= licznik+(1/i)
print(licznik)
5 changes: 5 additions & 0 deletions 03-ControlStructures/zad14.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
password = "qwerty123"
if len(password) < 8:
print(f"Password too short")
else:
print(f"Password ok")
7 changes: 7 additions & 0 deletions 03-ControlStructures/zad15.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sum = 0

number = 1
while number < 5:
number = number + 1 #just had to reverse the 5 and 6
sum = sum + number
print("Sum of numbers in <1,5> is ", sum)
7 changes: 7 additions & 0 deletions 03-ControlStructures/zad16.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
x=input("Enter value x: ")
y=input("Enter value y: ")

if x>y:
print(y,x)
else:
print(x,y)
11 changes: 11 additions & 0 deletions 03-ControlStructures/zad17.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
x=5
y=-2

if x>0 and y>0:
print("Point P{x}{y} is in the first quadrant. ")
elif x<0 and y>0:
print("Point P{x}{y} is in the second quadrant. ")
elif x<0 and y<0:
print("Point P{x}{y} is in the third quadrant. ")
elif x>0 and y<0:
print("Point P{x}{y} is in the fourth quadrant. ")
10 changes: 10 additions & 0 deletions 03-ControlStructures/zad18.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
a=[1,2,5]
b=int(input("Enter the amount: "))
c=0
x=2
while(x>=0):
c=b//a[x]
b-=(c*a[x])
if(c>0):
print(f"{c} time {a[x]} PLN")
x=x-1
9 changes: 9 additions & 0 deletions 03-ControlStructures/zad19.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
humanage=input("Enter the dog's age in human years: ")
dogage=0
while float(humanage)<=2.0:
for i in range(2):
dogage=dogage+10.5
break
else:
dogage=21+float(humanage)*4
print(dogage)
4 changes: 4 additions & 0 deletions 03-ControlStructures/zad20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
liczba=int(input("Wpisz liczbe z zakresu od 1 do 10: "))
for i in range(0,11):
wynik=i*liczba
print(wynik)
6 changes: 6 additions & 0 deletions 03-ControlStructures/zad21.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
university="UEK w Krakowie"
printowalnawersja=""

for i in university:
printowalnawersja=printowalnawersja+i+" "
print(printowalnawersja)
13 changes: 13 additions & 0 deletions 03-ControlStructures/zad22.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
for i in range(1,31):
if i%3!=0 and i%5!=0:
print(i)
elif i%3==0:
if i%5!=0:
print("THREE")
else:
print("BINGO")
elif i%5==0:
if i%3!=0:
print("FIVE")
else:
print("bingo")
2 changes: 2 additions & 0 deletions 03-ControlStructures/zad23.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for i in range(0,10):
print(str(i)*i)
8 changes: 8 additions & 0 deletions 03-ControlStructures/zad24.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
for i in range(0,6):
print("*"*i)
for j in range(6,0):
print("*"*i)
for i in range(6,0,-1):
print("*"*i)
for j in range(6,0):
print("*"*i)
11 changes: 11 additions & 0 deletions 03-ControlStructures/zad25.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
a= 4
b= 15
for i in range(1, a+1):
for j in range(1, b+1):
if(i==1 or i==a or
j==1 or j==b):
print("*", end="")
else :
print(" ", end="")
print()

Loading