Python Next-Level: Objekte in Datenstrukturen für Fortgeschrittene 🐍

Entdecke, wie du in Python komplexe Objekte in Datenstrukturen integrierst und deine Programmierung auf das nächste Level bringst. Perfekt für fortgeschrittene Entwickler!

Sara-Liya161 views15:59

About this video

Python Next-Level objektorientierte Programmierung - Objekte in Datenstrukturen Thema: Ich möchte dir heute mal eine Möglichkeit zeigen, wie man Objekte in Datenstrukturen, wie beispielsweise einer Liste aufnehmen kann, um somit das Programm einfacher und übersichtlich zu gestalten. Code (in dieser Lektion): class Smartphone: '''Das Smartphones Preise mit Rabattaktion.''' rabatt = 0.85 def __init__(self, phone_name, system, preis, dual_sim=False): self.phone_name = phone_name self.system = system self.preis = preis self.dual_sim = dual_sim Smartphone.rabatt = 0.70 # self.rabattierte_preis =(Smartphone.rabatt * self.preis) # print(self.rabattierte_preis) # p1 = Smartphone("Apple iPhone 13 Pro", "iOS 15", 1499, True) # p2 = Smartphone("Samsung Galaxy S22 Ultra", "Android 12", 990) smartphones = [Smartphone("Apple iPhone 13 Pro", "iOS 15", 1499, True), Smartphone("Samsung Galaxy S22 Ultra", "Android 12", 990), Smartphone("Xiaomi 12 5G 256GB", "Android", 530) ] # So greifen wir auf einzelne Werte zu: # print(smartphones[0].phone_name) # print(smartphones[1].phone_name) # print(id(smartphones[0])) # print(id(smartphones[1])) # print(id(smartphones[2])) for objekte in smartphones: print(objekte.phone_name, objekte.preis, objekte.dual_sim, sep=' - ') # print(p1.phone_name, p1.system, p1.preis, p1.dual_sim) # print(p2.phone_name, p2.system, p2.preis, p2.dual_sim) # # # print(Smartphone.__dict__) # # print(p1.__dict__) # # print(Smartphone.rabatt) # print(p1.rabatt)

Tags and Topics

This video is tagged with the following topics. Click any tag to explore more related content and discover similar videos:

Tags help categorize content and make it easier to find related videos. Browse our collection to discover more content in these categories.

Video Information

Views
161

Total views since publication

Likes
7

User likes and reactions

Duration
15:59

Video length

Published
Dec 16, 2022

Release date

Quality
hd

Video definition

Related Trending Topics

LIVE TRENDS

This video may be related to current global trending topics. Click any trend to explore more videos about what's hot right now!

THIS VIDEO IS TRENDING!

This video is currently trending in Morocco under the topic 'météo demain'.

Share This Video

SOCIAL SHARE

Share this video with your friends and followers across all major social platforms including X (Twitter), Facebook, Youtube, Pinterest, VKontakte, and Odnoklassniki. Help spread the word about great content!