Classes and objects. Just started learning, working in python.
https://lemmy.world/post/18326107
Classes and objects. Just started learning, working in python. - Lemmy.World
So I have struggled with classes and objects but think I’m starting to get it…?
As part of a short online class I made a program that asked a few multiple
choice questions and returns a score. To do this there are a few parts. 1.
Define some inputs as lists of strings ((q, a), (q2, a2),…). The lists contain
the questions and answers. This will be used as input and allows an easy way to
change questions, add them, whatever. 2. Create a class that takes in the list
and creates objects - the objects are a question and it’s answer. 3. Create a
new list that uses that class to store the objects. 4. Define a function that
iterates over the list full of question/answer objects, and then asks the user
the questions and tallies the score. Number 2 is really what I am wondering
about, is that generally what a class and object are? I would use an analogy of
a factory being a class. It takes in raw materials (or pre-made parts) and
builds them into standard objects. Is this a reasonable analogy of what a class
is?
Just started learning python - question about types of statements.
https://lemmy.world/post/18013689
Just started learning python - question about types of statements. - Lemmy.World
Just started as in, I’m about an hour into a 4 hour intro video. Seeing two
basic ways of manipulating things and don’t understand the difference. If I want
to know the length of a string and I just guess at how to do it I would try one
of these two things, 1. Len(string) 2. string.len() What is the difference
between these types of statements? How do I think about this to know which one I
should expect to work?
I don't think Seska had anything to do with ending of Worst Case scenario (Voyager S3E25).
https://lemmy.world/post/2719977
I don't think Seska had anything to do with ending of Worst Case scenario (Voyager S3E25). - Lemmy.world
I think this episode is part one of the holonovel followed by the second part
during the second half. The only break we take from seeing the holonovel be
played is when they tell captain Janeway (where she implies that she has to be
made to look good) about the first half and when Tom and Tuvok are in the mess
hall being hassled by everyone who wants to help write the second half. Tom and
Tuvok write the ending off screen (there is dialog where they argue about a
logical ending or a wild twist). The Twist is that part two picks up with the
player of the novel meeting Tuvok in the hallway to go to the holodeck to help
write the ending. When the player gets there they then get attacked by Seska and
get to help rescue Voyager while novel character Janeway helps save the day by
brilliantly editing the simulation (in a holonovel simulation).