lesopdracht 1 af
This commit is contained in:
parent
1e74657033
commit
b2143713e9
|
@ -0,0 +1,4 @@
|
|||
namen = ['peter', 'pator', 'piotr', 'pieter', 'pablo']
|
||||
for naam in namen:
|
||||
print(naam)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
invoer = int(input('Geef een getal broer: '))
|
||||
|
||||
try:
|
||||
print(invoer / 100)
|
||||
except:
|
||||
print('Kan niet door 0 delen gast')
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
blabladfalf dsfjsflksjf
|
||||
ddddf dsfjsklfjklsf
|
||||
sfdkfjdkfjdkfjdkfdkfjdkf
|
|
@ -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)
|
|
@ -0,0 +1,2 @@
|
|||
nested = [[3, 1, 5], [7, 4, 6]]
|
||||
print(nested[1][1])
|
|
@ -0,0 +1,2 @@
|
|||
import os
|
||||
print(os.getcwd())
|
|
@ -0,0 +1,5 @@
|
|||
grootin = int(input('Geef een getal: '))
|
||||
if grootin > 100:
|
||||
print('GROOT')
|
||||
else:
|
||||
print('klein')
|
|
@ -0,0 +1,3 @@
|
|||
kleuren = {'auto':'rood', 'trein':'geel', 'ambulance':'geel'}
|
||||
for i in kleuren:
|
||||
print(i + ' is ' + kleuren[i])
|
|
@ -0,0 +1,2 @@
|
|||
a = 'The client connects to the server by calling socket()'
|
||||
print(a[4:10])
|
|
@ -0,0 +1,2 @@
|
|||
a = 'The client connects to the server by calling socket()'
|
||||
print(a[-8:])
|
|
@ -0,0 +1,3 @@
|
|||
a = 'The client connects to the server by calling socket()'
|
||||
for i in a[-8:]:
|
||||
print(i, end=" ")
|
|
@ -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)
|
|
@ -0,0 +1,6 @@
|
|||
while True:
|
||||
invoer = input('Geef voer! ')
|
||||
if invoer == ('stop' or 'Stop' or 'STOP'):
|
||||
exit(0)
|
||||
else:
|
||||
print(invoer)
|
|
@ -0,0 +1,7 @@
|
|||
def dubbel(invoer):
|
||||
return int(invoer * 2)
|
||||
|
||||
|
||||
print(dubbel(3))
|
||||
print(dubbel(60))
|
||||
print(dubbel(-3))
|
Reference in New Issue