Skip to main content

All Questions

Tagged with
0 votes
2 answers
101 views

How can I store a function in an array in python?

I am trying to to store a function in an array and store that array in a dictionary so I can later call values from that array through the dictionary. I created a zeros array and created a loop that ...
user23622626's user avatar
1 vote
1 answer
35 views

Updating the Hangman Game with Scaffold Python

I am currently looking into updating the hangman game to show the scaffold image with a new body part appearing everytime a guessed answer is wrong. I have been told the best way to show the scaffold ...
AJHedges's user avatar
0 votes
1 answer
43 views

How to clear the screen in Python when a certain condition is met when execution of the code? [duplicate]

basically what I am asking is imagine you made a game in Python and after you once play it and finished it, we ask the user if they would like to continue? if they choose 'yes', is there a way to ...
user avatar
-2 votes
2 answers
42 views

Python - main function helpb

Please enter a command: ls No recipe in meal plan yet. Please enter a command: ls -a chocolate peanut butter banana shake chocolate brownies seitan cinnamon rolls peanut butter omelette Please enter a ...
Mansi's user avatar
  • 1
0 votes
1 answer
619 views

TypeError: economico() missing 2 required positional arguments: 'carro' and 'consumo' [duplicate]

I have an assignment to turn in for the University. I already got the correct result in VS Code with the code below (the idea is to show the car with the lowest consumption): def entrada_carro(): ...
brasoares's user avatar
  • 103
-4 votes
3 answers
5k views

Multiplication or sum of two numbers [closed]

Given two integer numbers, return their product only if the product is equal to or less than 1000, else return their sum. def multiplication_or_sum(num1, num2): product = num1 * num2 if ...
Khalilomorph's user avatar
0 votes
4 answers
448 views

Format message by calling a written python function name in string

I have functions def getName(): name = "Mark" return name def getDay(): day = "Tuesday" return day I have a variable message = "Hi there [getName] today is [...
thisissifumwike's user avatar
0 votes
2 answers
137 views

Why does my python 2.7 code print 'false' when the components are true?

I'm working on two user defined functions, one that calls upon the first, that determines if inputs given are parallelograms or rectangles, but when I set my if statements, even if the inputs fulfill ...
Dean OKeefe's user avatar
0 votes
1 answer
102 views

Function ignored by code, if written inside another function [closed]

I have written a new Function1 (data_city) which is ignored if inserted inside another Function2 (write). I do not understand the problem. Previously I removed Function1 (data_city) and I copied / ...
Giovanni Russo's user avatar
0 votes
1 answer
273 views

Google foobar question 1, minion job handling

I recently got an invitation to google foobar. I am stuck on the first problem. The problem is to: write a function called solution(data, n) that takes in a list of less than 100 integers and a number ...
AouxWoux's user avatar
1 vote
0 answers
56 views

Function doesn't shows password in real time

When I click show password it shows password but when I input 1 more letter in the entry box then that letter doesn't show up but when I input one more letter the previous letter shows up but the ...
bhavin nor's user avatar
-4 votes
3 answers
2k views

How to pass a 2-dimensional list to a function? [closed]

this is my first post. The Problem: I have 2-Dimensional-list which is decleared and filled in a function - looks like this: data = [[1, 2, 3, 4], [10, 20, 30, 40]] - Now I want to pass that list from ...
Djordje-Stojanovic's user avatar
0 votes
1 answer
39 views

Unpack function to variables if output is not false

Is there a more elegant way to check if function output is not false? If not, is the second method good solution if function is costly? def get_first_last_name(name): if ' ' not in name: ...
Nick's user avatar
  • 11
0 votes
0 answers
754 views

What exactly is main.py in python and how do I use it to create a one file executable using pyinstaller?

I am currently working on a demo project while learning python and decided to use Tkinter as a user interface for my system. After finishing on the GUI and setting up a MySQL database I tried to use ...
Michael Kagera's user avatar
0 votes
5 answers
423 views

Can you change function names a in while loop - python3

I was wondering if you can change function names while in a while loop? For example, if I had an X amount of functions called function1, function2, function3, functionX, could I execute the function ...
dajmiacc's user avatar

15 30 50 per page
1
2 3 4 5
41