1

lesopdracht 1 af

This commit is contained in:
ventilaar 2021-09-07 10:50:08 +02:00
parent 1e74657033
commit b2143713e9
17 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,4 @@
namen = ['peter', 'pator', 'piotr', 'pieter', 'pablo']
for naam in namen:
print(naam)

View File

@ -0,0 +1,6 @@
invoer = int(input('Geef een getal broer: '))
try:
print(invoer / 100)
except:
print('Kan niet door 0 delen gast')

View File

@ -0,0 +1,8 @@
with open('11.txt', 'r') as file:
lines = file.readlines()
iter = 1
for line in lines:
print(str(iter) + ' ' + line.rstrip())
iter = iter + 1

View File

@ -0,0 +1,3 @@
blabladfalf dsfjsflksjf
ddddf dsfjsklfjklsf
sfdkfjdkfjdkfjdkfdkfjdkf

View File

@ -0,0 +1,13 @@
def doeIets(x):
if x < 10:
y = 'x is kleiner dan 10'
elif x >= 10 and x < 20:
y = 'x tussen 10 en 20'
else:
y = 'x is groter dan 19'
return y
z = doeIets(int(input('Geef getal broer: ')))
print(z)

View File

@ -0,0 +1,2 @@
nested = [[3, 1, 5], [7, 4, 6]]
print(nested[1][1])

View File

@ -0,0 +1,2 @@
import os
print(os.getcwd())

View File

@ -0,0 +1,5 @@
grootin = int(input('Geef een getal: '))
if grootin > 100:
print('GROOT')
else:
print('klein')

View File

@ -0,0 +1,3 @@
kleuren = {'auto':'rood', 'trein':'geel', 'ambulance':'geel'}
for i in kleuren:
print(i + ' is ' + kleuren[i])

View File

@ -0,0 +1,2 @@
a = 'The client connects to the server by calling socket()'
print(a[4:10])

View File

@ -0,0 +1,2 @@
a = 'The client connects to the server by calling socket()'
print(a[-8:])

View File

@ -0,0 +1,3 @@
a = 'The client connects to the server by calling socket()'
for i in a[-8:]:
print(i, end=" ")

View File

@ -0,0 +1,10 @@
sorteermij = (1, 3, 6, 1, 7, 3, 9, 2, 5, 2)
gesorteerd = sorted(sorteermij)
print(gesorteerd)
totaal = 0
for i in gesorteerd:
totaal = totaal + i
print(totaal)

View File

@ -0,0 +1,6 @@
while True:
invoer = input('Geef voer! ')
if invoer == ('stop' or 'Stop' or 'STOP'):
exit(0)
else:
print(invoer)

View File

@ -0,0 +1,7 @@
def dubbel(invoer):
return int(invoer * 2)
print(dubbel(3))
print(dubbel(60))
print(dubbel(-3))