modified: 2.Erste Programme/4. Fahrkartenautomat Python/main.py
new file: "3. \303\234bungen/10.03.2022/Ausgabewerte.py" new file: "3. \303\234bungen/10.03.2022/Programmfehler.py" new file: "3. \303\234bungen/10.03.2022/Zylinder.py"
This commit is contained in:
11
3. Übungen/10.03.2022/Ausgabewerte.py
Normal file
11
3. Übungen/10.03.2022/Ausgabewerte.py
Normal file
@ -0,0 +1,11 @@
|
||||
## Übung Wertzuweisung
|
||||
|
||||
x=12
|
||||
y=8
|
||||
|
||||
z=y*x+2 #8*12+2 = 98
|
||||
v=z%x #2
|
||||
w=z//x #8
|
||||
u=v**w #256
|
||||
|
||||
print(z,v,w,u)
|
17
3. Übungen/10.03.2022/Programmfehler.py
Normal file
17
3. Übungen/10.03.2022/Programmfehler.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Programmfehler finden!
|
||||
'''
|
||||
print('Gib Zahl 1 ein")
|
||||
input zahl1
|
||||
input(Gib Zahl 2 ein)
|
||||
|
||||
differenz=zahl1+zahl2
|
||||
print(diffrenz)
|
||||
'''
|
||||
# Lösung
|
||||
# Programm, welches die Differenz zweier Zahlen berechnet (also Subtraktion/Minus)
|
||||
print('Gib Zahl 1 ein')
|
||||
zahl1 = int(input())
|
||||
zahl2 = int(input("Gib Zahl 2 ein"))
|
||||
|
||||
differenz=zahl1-zahl2
|
||||
print(differenz)
|
16
3. Übungen/10.03.2022/Zylinder.py
Normal file
16
3. Übungen/10.03.2022/Zylinder.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Das Programm berechnet den Oberflächinhalt und Volumen eines Zylinders
|
||||
from cmath import pi
|
||||
|
||||
|
||||
durchmesser = int(input('Durchmesser:'))
|
||||
höhe = int(input('Höhe:'))
|
||||
|
||||
# hier felt die Verabreitung
|
||||
radius=durchmesser/2
|
||||
# Oberflächeninhalt
|
||||
oberflächeninhalt=2*pi*radius*(radius+höhe)
|
||||
|
||||
#Volumen
|
||||
volumen=pi*(radius**2)*höhe
|
||||
# Ausgabe
|
||||
print('Oberflächeninhalt',oberflächeninhalt,'\r\n','Volumen:', volumen)
|
Reference in New Issue
Block a user