Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: exiting the outer function from the inner function
Post: RE: exiting the outer function from the inner func...

(Feb-26-2021, 10:14 PM)nilamo Wrote: x = inner()...     if "return" == x["next"]:...         returnThank you. This helped. I also did some tweaking to deal with the recursion issue.
banidjamali General Coding Help 3 3,556 Feb-27-2021, 09:47 AM
  Question Thread: Text color (ascii) in a dictionary
Post: Text color (ascii) in a dictionary

Hello everyone. In this code: spots = {1: '1', 2: '2', 3: '3'} spots[1] = '\033[93mONE\033[0m' print(spots[1]) print(spots)why the color only applies to the first print line and the dictionary item ...
banidjamali General Coding Help 1 1,847 Feb-24-2021, 05:44 PM
  Question Thread: exiting the outer function from the inner function
Post: exiting the outer function from the inner function

Hello everyone. In the code below I have simplified a result I'm trying to achieve. I want to know how I can exit the outer function when the inner function returns a specific choice: def outer_func...
banidjamali General Coding Help 3 3,556 Feb-24-2021, 07:16 AM
    Thread: Decorator for a function with argument(s)
Post: Decorator for a function with argument(s)

Hello everyone, considering the code I've written here, please tell me: 1. Is this done correctly? (Although I get the correct output, someone told me for functions that take inputs, I need a wrapper...
banidjamali Homework 1 1,827 Feb-09-2021, 10:30 AM
    Thread: Play again, in a guessing game
Post: RE: Play again, in a guessing game

(Jan-20-2021, 06:38 PM)snippsat Wrote: def menu():Very helpful. Thank you.
banidjamali Homework 4 11,689 Jan-22-2021, 06:23 AM
  Question Thread: Play again, in a guessing game
Post: Play again, in a guessing game

Hello! Here the computer comes up with a number in range(1, 9), and we try to guess it, until we come up with the correct number. We can exit anytime during the game and also at the end we have the ...
banidjamali Homework 4 11,689 Jan-20-2021, 08:03 AM
    Thread: Rock, paper, scissors spelling error
Post: RE: Rock, paper, scissors spelling error

@buran @deanhystad Thank you both for providing a lot of good information.
banidjamali Homework 6 3,220 Jan-19-2021, 02:51 PM
    Thread: Rock, paper, scissors spelling error
Post: RE: Rock, paper, scissors spelling error

(Jan-19-2021, 08:52 AM)buran Wrote: validate the user inputThank you! they both helped a lot. I did this: player1 = input("Give player 1 a name:\n") player2 = input("Give player 2 a name:\n") choic...
banidjamali Homework 6 3,220 Jan-19-2021, 12:04 PM
  Question Thread: Rock, paper, scissors spelling error
Post: Rock, paper, scissors spelling error

Hello! Hope everybody's fine. Here I have written a RPS game: player1 = input("Give player 1 a name:\n") player2 = input("Give player 2 a name:\n") while True: choice1 = input(f"{player1}, star...
banidjamali Homework 6 3,220 Jan-19-2021, 08:42 AM
    Thread: Top 3 students
Post: RE: Top 3 students

(Jan-17-2021, 09:49 AM)Serafim Wrote: scores = sorted(scores.items(), key=lambda x: x[1], reverse=True)Yes, I didn't notice the mistake in my output! This line really helped. Thank you all.
banidjamali Homework 4 2,327 Jan-17-2021, 11:59 AM
    Thread: Top 3 students
Post: Top 3 students

Hello everyone. Hope you are all having a great time. Here's a simple question: There's a dictionary, and I want to extract the top 3 students from it. I have successfully achieved the goal and the ...
banidjamali Homework 4 2,327 Jan-17-2021, 09:08 AM
    Thread: Extracting results from a dictionary...
Post: RE: Extracting results from a dictionary...

(Jan-11-2021, 03:59 PM)buran Wrote: Also, note that if you want to use both key and value you can iterate over dict.items()Thank you! @buran
banidjamali Homework 4 2,470 Jan-12-2021, 12:07 PM
    Thread: Extracting results from a dictionary...
Post: RE: Extracting results from a dictionary...

(Jan-11-2021, 12:16 PM)Serafim Wrote: print(i, dictName[i], "(Failed)" if dictName[i] < 70 else "")Thank you @Serafim
banidjamali Homework 4 2,470 Jan-11-2021, 12:29 PM
    Thread: Extracting results from a dictionary...
Post: Extracting results from a dictionary...

Hello everyone, I hope you are having a great day. Here's a simple question. I have a dictionary: dictName = {"Jane": 90, "Max": 88, "David": 65, "Sarah": 57, "Vi": 62}I'm trying to get a result like...
banidjamali Homework 4 2,470 Jan-11-2021, 11:38 AM
    Thread: Check if all the numbers are higher than five and if not...
Post: RE: Check if all the numbers are higher than five ...

(Jan-11-2021, 11:00 AM)Serafim Wrote: 123456 numbersList = [6, 3, 9, 36, 96, 1, 18, 99, 8, 5, 12, 2]invalid = [x for x in numbersList if x < 5]if invalid:    print('Y...
banidjamali Homework 3 2,106 Jan-11-2021, 11:21 AM
    Thread: Check if all the numbers are higher than five and if not...
Post: Check if all the numbers are higher than five and ...

Hello everyone, I hope you are having a great day. Here's a simple question. I have a list of numbers: numbersList = [6, 3, 9, 36, 96, 1, 18, 99, 8, 5, 12, 2]I want an output like this: If they are a...
banidjamali Homework 3 2,106 Jan-11-2021, 10:11 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020