Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions groep_team2_leider_week1_task/Q1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Qustion num 1 :
for i in range(1,11):
print(i)



23 changes: 23 additions & 0 deletions groep_team2_leider_week1_task/Q10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def calculate_weight_index():
# Ask user for weight (in kg) and height (in meters)
weight = float(input("Enter your weight in kilograms (kg): "))
height = float(input("Enter your height in meters (m): "))

# Calculate weight index:
weight_index = weight / (height ** 2)

# Determine the category based on BMI
if weight_index < 25:
category = "underweight"
elif 25 <= weight_index < 30:
category = "normal"
elif 30 <= weight_index < 40:
category = "overweight"
else: # weight_index >= 40
category = "obese"
# Display the result
print(f"\nYour weight_index is: {weight_index:.2f}")
print(f"According to the weight_index, you are: {category}")

# Run the function
calculate_weight_index()
14 changes: 14 additions & 0 deletions groep_team2_leider_week1_task/Q11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def large(num1,num2,num3):
if num1 > num2 and num1 > num3 :
return num1
elif num2 >=num1 and num2>=num3:
return num2
else:
return num3

num1=int(input("enter num1 :"))
num2=int(input("enter num2 :"))
num3=int(input("enter num3 :"))

find_larg=large(num1,num2,num3)
print(f"the largest is {find_larg}")
15 changes: 15 additions & 0 deletions groep_team2_leider_week1_task/Q12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Quetion 12
total_les=1
sum=0
while total_les <=4 :
print(f"\nCourse {total_les}")
les1=input(f"enter the course name : ")
midterm=int(input(f"enter the midter for course{total_les} :"))
final_grade=int(input(f"enter the final grade for course{total_les}:"))
total_les +=1
avg=(midterm*.4)+(final_grade*.6)
if avg >=50 :
status="Succful "
else:
status="Faild"
print(f"the course : {les1} - Average : {avg} is {status}")
13 changes: 13 additions & 0 deletions groep_team2_leider_week1_task/Q2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Vraag de gebruiker om een getal in te voeren
number = int(input("enter the positief numb : "))

print("Even getallen met een for-lus:")
for i in range(0, number + 1, 2):
print(i)

print("\nEenter the positief numb :")
i = 0
while i <= number:
print(i)
i += 2
5 changes: 5 additions & 0 deletions groep_team2_leider_week1_task/Q3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Quetion 3 :
start=int(input("Enter the first num :"))
end=int(input("Enter the last num:"))
for num in range(start,end+1):
print(num)
5 changes: 5 additions & 0 deletions groep_team2_leider_week1_task/Q4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
in_num=int(input("enter the num : "))
if in_num %2==0:
print(f"{in_num} : is even ")
else:
print(f"{in_num} : is Odd ")
8 changes: 8 additions & 0 deletions groep_team2_leider_week1_task/Q5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
num=int(input("enter the positive num : "))
fact=1
if num > 0 :
for i in range(1,num+1) :
fact=fact*i
print(f"the factrial for {num} : {fact}")
else:
print("you can enter a positive number ")
11 changes: 11 additions & 0 deletions groep_team2_leider_week1_task/Q6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
num=int(input("enter the num : "))
if num > 1:
for i in range(2,num):
if num % i==0:
print("not prime ")
break
else:
print("this number is prime.")

else:
print("this number not prime .")
27 changes: 27 additions & 0 deletions groep_team2_leider_week1_task/Q7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Question 7:

seq = int(input("How many number you want ? "))
# first two terms
n1, n2 = 0, 1
count = 0
l=[0,1]
print(l)
# check if the number of terms is valid
if seq <= 0:
print("Please enter a positive integer")
elif seq==1:
print("Fibonaci sequence :")
print(l[0])
else:
# if there is only one term, return n1

print("Fibonacci sequence:")
while count < seq:

nth = n1 + n2
l.append(nth)
# update values
n1 = n2
n2 = nth
count += 1
print(l)
8 changes: 8 additions & 0 deletions groep_team2_leider_week1_task/Q8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
user_wrd=input("enter the word you want to reverse :")
reverse_wrd=user_wrd[::-1]
print(reverse_wrd)
#========Andere manier =============
rev=" "
for i in user_wrd:
rev=i +rev
print(rev)
6 changes: 6 additions & 0 deletions groep_team2_leider_week1_task/Q9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
user_word = input("inter a word: ")
if user_word == user_word[::-1]:
print(f" The woord {user_word} - is palindrome")
else:
print(f"the woord {user_word} - is not palindrome")