Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: clear screen with pycharm
Post: clear screen with pycharm

Hi ,I have found in the internet a code to clear a screen: def clear_screen(): os.system('cls' if os.name == 'nt' else 'clear')However I cannot use it, because if i type print("nt" in os.name) o...
boris602 General Coding Help 0 2,154 Dec-12-2019, 12:28 PM
    Thread: How to exclude bools from integers?
Post: RE: How to exclude bools from integers?

thanks, now i know what i have to change **smile**
boris602 General Coding Help 2 1,932 Nov-02-2019, 12:44 PM
    Thread: How to exclude bools from integers?
Post: How to exclude bools from integers?

Hi , for excluding everything, but integers i have found this code isinstance(n,int). My Problem is, if i writeisinstance(n,int) == True and n!= True or False, 0 and 1 will not remain in my code. Is...
boris602 General Coding Help 2 1,932 Nov-02-2019, 12:08 PM
    Thread: "100 prisoner problem" (attempts)
Post: RE: "100 prisoner problem" (attempts)

def my_prisoners(p): for i in range(6): attempt=0 idx=i found= False while attempt<3: if p[idx]==i+1: found=True brea...
boris602 General Coding Help 11 7,507 Jan-28-2018, 11:04 PM
    Thread: "100 prisoner problem" (attempts)
Post: RE: "100 prisoner problem" (attempts)

well i actually found the mistake already, just trying to correct it, i need to make -1.For example this would work until 1 stays on "i=0" def my_prisoners(p): for i in range(6): attempt=...
boris602 General Coding Help 11 7,507 Jan-28-2018, 08:57 PM
    Thread: "100 prisoner problem" (attempts)
Post: RE: "100 prisoner problem" (attempts)

def my_prisoners(p): for i in range(6): attempt=0 idx=i found= False while attempt<3: if p[idx]==i+1: found=True brea...
boris602 General Coding Help 11 7,507 Jan-28-2018, 07:16 PM
    Thread: "100 prisoner problem" (attempts)
Post: RE: "100 prisoner problem" (attempts)

I dont want to spam,so i just write it here. Since the code seems to work , i want to change it in a way , that my index starts of 1. def my_prisoners(p): for i in range(6): attempt=0 ...
boris602 General Coding Help 11 7,507 Jan-28-2018, 03:08 PM
    Thread: "100 prisoner problem" (attempts)
Post: RE: "100 prisoner problem" (attempts)

well i know see my own problem,because my cycle(5,4,3,2,1,0),doesnt really match with the code. I gonna try to change it first, because box5 really should contain number 1 in this code, what actually ...
boris602 General Coding Help 11 7,507 Jan-28-2018, 01:09 PM
    Thread: "100 prisoner problem" (attempts)
Post: RE: "100 prisoner problem" (attempts)

(Jan-28-2018, 12:07 PM)j.crater Wrote: I don't really understand what the code should be doing and what are the expected results. The idea in this code should be that every prisoner gets the number...
boris602 General Coding Help 11 7,507 Jan-28-2018, 12:26 PM
    Thread: "100 prisoner problem" (attempts)
Post: "100 prisoner problem" (attempts)

Hello guys, i have found a code in the internet that i changed a bit. I tested it for a small group of prisoners , but the problem is, that my result shows always "True". def my_prisoners(p): for...
boris602 General Coding Help 11 7,507 Jan-28-2018, 11:59 AM
    Thread: random permutation
Post: random permutation

Hi guys,for a homework about the "100 prisoner problem" i need some command that gives me a random permutation that i can find in "p".p=Permutations(100). I would be really grateful for some help.
boris602 Homework 2 3,012 Jan-27-2018, 06:32 PM
    Thread: Need to find a mistake in my code
Post: RE: Need to find a mistake in my code

thanks, now everything works.
boris602 General Coding Help 3 3,095 Jan-11-2018, 01:49 PM
    Thread: Need to find a mistake in my code
Post: Need to find a mistake in my code

A=Matrix([[1,2,0],[4,5,0],[7,8,9]]);A def Kostenmatrix(A): C=Matrix(A.nrows(),[]) for i in range(0.A.nrows()): for j in range(0,A.nrows()): if i==j: C[i,j]=...
boris602 General Coding Help 3 3,095 Jan-11-2018, 12:26 PM
    Thread: recursive procedure(total beginner)
Post: RE: recursive procedure(total beginner)

The length is defined how long this procedure "x_(k+1)=p(x_k)-x_k" runs until i reach 0. So for example for x_0=7 , x_1 is =1 and x_2 is =0. So the length must be 2, but i dont know how i can code th...
boris602 Homework 5 3,658 Dec-13-2017, 12:59 PM
    Thread: recursive procedure(total beginner)
Post: RE: recursive procedure(total beginner)

i have changed my code now, i did not know the difference between "print" and "return"︠ def divisorGenerator(n): large_divisors = [] for i in xrange(1, int(math.sqrt(n) + 1)): if n %...
boris602 Homework 5 3,658 Dec-13-2017, 10:10 AM
    Thread: recursive procedure(total beginner)
Post: recursive procedure(total beginner)

Hello guys , for my homeworks i need to create a recursive procedure for x_(k+1)=p(x_k)-x_k. x_k is some number and p(x_k) is defined as the sum of all number that can divide x_k. At the end the code ...
boris602 Homework 5 3,658 Dec-12-2017, 02:29 PM

User Panel Messages

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