Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
This is just a question and I don't have any example code. But let's say that you were to make a python program were you have a "star" variable the star variable holds an integer and that integer is the age of the star, each time the program loops it adds a value of 1 to the star variable and if the star variable is equal to 100 it will create a new star which has its variable and the same process will occur with this variable as well.
How would you create a whole new variable or something along these lines without assigning one while writing the program?
You could store the object in a list. As a new star is created, just append it.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I'm making a blackjack game that requires me to calculate the scores at the end of multiple games such as what your cards added up to at the end of the games and find out the mean, mode and frequency. I've gotten the data laid out in a spread sheet but can't figure out how to read and add the score from the separate games since they're all being added together into one variable
My python code that prints and reads out the stats
The stats my code gets the data from
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 days ago.
Improve this question
• Write the pseudocode to put zero into variable running_total. Then write
separate instructions to add the following numbers onto what is in the
variable, adding one number at a time 5, 8, 2, 3. Print running_total.
can i know the answer for this question
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
I have some Python code that takes user input for mass and diameter of an object. Those data parameters I later use in a calculation formula. Instead of having the user input those two values, I now have a dictionary that stores the values. How can I now have those values extracted from the dictionary and placed into the calculation formula? I'm very new to Python and trying to figure out if this done via a while loop or defining an function within a while loop, etc.
Thanks.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Suppose I have the some code in which I used map() function.
I know I can later print it by converting it to list just like this :
get_something = map(some_function, some_list)
print(list(get_something))
But Is there any way other than list. I mean what if I want to print not as list but line by line and don't want to use for loop every now and then?
Why dont you try this:
print(*map(some_function, some_list),sep='\n')
By this print() will refer to map object and will print values with \n as a separator
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have list, its elements are also a list.
eg:
outlier=[[20,2,67], [90,6,12], [23,16,7]].
how I write a single line code to loop outlier list by taking elements from same index.I want to store the looping result as a list.
The question is not very clear to me, but if you want to make a new list that contains the first element of each list you have, then this is an example to take first element(x[0]) from each list and store them in a new list called "new_list":
new_list = [x[0] for x in outlier]