Files
Python-Schulung/Montag/if.py
2022-11-22 14:45:34 +01:00

21 lines
466 B
Python

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
mydict = { 'hostname' : "notebook43",
'address': '192.168.1.243',
'OS' : 'Debian 5.10.149-2',
'ssd' : True,
'ramsize' : 16,
'maker' : "Lenovo",
'type' : "T232"
}
if 'maker' in mydict:
print("Key exist")
if 'maker' in mydict and 'type' in mydict:
if mydict['maker'] =='Lenovo' and mydict['type'].startswith('T'):
print("Es ist ein Thinkpad")