Skip to content
Sign UpLog In
Profile icon

seb16120

@FineMouche
26Y.O bad self learner for some reasons.
  • Custom BattleShip

    Cover page
    Made with Python

    W.I.P you can select size of board, numbers of sizes boats, numbers of boats of each sizes, numbers of turns before you lose.

    Recent comments (0)
Repls
Community
FineMouche
FineMouche
published an Update
1 year ago
0
Rust-like  Option and Result in python
Rust-like Option and Result in pythonhttps://pypi.org/project/option/
why the given module developers example don't work ?
replit installed the module Option because i tried pip myself and it say that it's already installed. They are manies lines or error so i don't understand what is the issue
FineMouche
FineMouche
published an Update
1 year ago
0
how change the fill color without it be random ?
i want change it gradually but all try i made failed ...
phamn23
phamn23
@FineMouche You used the `random` function so the color will be randomized... If you wanted colors to transition then you could use a counter variable that increments every frame: ```js // initialize variables let counter = 0 // p5.js's draw function function draw() { // increment the counter & use modulo (%) to ensure the counter remains between 0 & 255 counter = (counter + 1) % 255 // fill using the counter fill(counter) } ``` Note that I'm using JS and you're using Python. Also, using only one `variable` will result in various shades of black. Try using several different counters and putting them into `fill` to transition between colors. I forked your repl if you want to see another solution that transitions between the `colors` array you specified, rather than just shades of black. https://replit.com/@phamn23/p5-try#index.html1 year ago
FineMouche
FineMouche
@phamn23 thanks you1 year ago
FineMouche
FineMouche
published an Update
1 year ago
1
why =+ don't work with tuples ?
like in friends =+ ("Seb",)
FineMouche
FineMouche
@MrVoo what you mean by using comma to add a value ?1 year ago
MrVoo
MrVoo
@FineMouche nevermind :I1 year ago
FineMouche
FineMouche
@MrVoo thx its very more clear now ... I will watch a video or read an article about tuples if you don't want clarify :/1 year ago
FineMouche
FineMouche
shared a Post
1 year ago
it say : "ImportError: cannot import name 'cache' from 'functools' (/usr/lib/python3.8/functools.py)"
cache
Python
emilyDoesPascal
emilyDoesPascal
functools.cache is only avaliable from python 3.9 onwards1 year ago
FineMouche
FineMouche
shared a Post
2 years ago
i tried something L10 but it didn't worked edit : i fix my issue with : import os os.environ['TZ'] = 'Europe/Paris' time.tzset()
date time tests
Python
CodingElf66
CodingElf66
Very well! I'll show you how to do it! import datetime print(str(datetime.datetime.now(timezone))) Here, you can choose your timezone, then it would return the time in your timezone! Hope this helps, hope you can mark it as answered!2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
Like 9:55:32 in second from time.time() or from datetime.now().time() . And why 'date' is diplay in cyan but make an error when printed ?
multiplieur d'heures
Python
FineMouche
FineMouche
ok, so by not answered me, what i should understand ? That i must search even more on google ?2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
ruiwenge2
ruiwenge2
on line 21 do ls.append(s) 2 years ago
Coder100
Coder100
image remove the los silly!2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
i imported math so what is the issue ? -> fixed so now i want know : how i can tell to python use sqrt() as math.sqrt() ? -> answered
distance to earth due to straight walking
Python
InvisibleOne
InvisibleOne
Import sqrt() from math, like this: from math import sqrt and then you can sqrt(25) Or else you have to do: import math math.sqrt(20) Or if you really want to you can do this from math import sqrt as whateveryouwant whateveryouwant(25) And if you want everything from math, just put * which imports everything. from math import * 2 years ago
Coder100
Coder100
You didn't import it all, you must do: from math import * sqrt(...) otherwise, it is bound to math, like: math.sqrt(...)2 years ago
ruiwenge2
ruiwenge2
you have to use math.sqrt()2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
it's my first time i import a code via Github. *BTW do my token is well used by putting 'mysecret' in 'bot.run(os.getenv(mysecret))' ? it was 'bot.r
image_bot
Python
Coder100
Coder100
nope, it was bot.run(os.getenv('TOKEN')) and that is correct. Then, you click on the padlock in the navbar to your left, and you set the key, TOKEN to the value: your discord bot token. Keep this secure! You don't want to see that in your editor, only in your secrets.2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
i followed this video to make a chess board : https://www.youtube.com/watch?v=D_OiVkIgyGE
Chess board
Python
19ecal
19ecal
Just ignore that it's just a warning and you can't do anything about it2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
@eankeen hi normally it's your program, you have many repli i don't find it in replis you made :/ Where i see your program : https://blog.repl.it/fix
pygame-moving-dvd-Copied from email
Python
SixBeeps
SixBeeps
Here's the Repl, taken straight from the Repl name: https://repl.it/@eankeen/pygame-moving-dvd-logo2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
i tried 4 differents method to do it but all method give me a error :/
Argument unpacking in Python
Python
FineMouche
FineMouche
ok i wrote -600,50 instead of -600.50 ><2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
1) don't use it, 2) make your "future" argument = None first.
Mutable default arguments (bad idea)
Python
FineMouche
FineMouche
shared a Post
2 years ago
i try to copy the form/structure i used in my course of inheritance in python but here it seem it need to do something specific due to the fact i try
Database with some context manager
Python
RYANTADIPARTHI
RYANTADIPARTHI
You are getting this error because you are trying to commit a nonetype. meaning like there is something having a none value, and you are trying to commit it.2 years ago
FineMouche
FineMouche
shared a Post
2 years ago
it's annoying because the if is by example : Rolf\n == Rolf ? so it answer no ... How i suppr the \n from the pressing enter between each lines of m
files in python
Python
RYANTADIPARTHI
RYANTADIPARTHI
If you want to break it up on separate lines without the entire line, then do this: print("hi") print() # empty print means space print("hi again!") `2 years ago
FineMouche
FineMouche
"people_list = people.split(" ") AttributeError: '_io.TextIOWrapper' object has no attribute 'split'" F*ck qdsefhjkvgdsqgfvkhgv Why it work for input() and not for a .txt ... sad. 2 years ago
FineMouche
FineMouche
shared a Post
3 years ago
Why it's seems only to be preset functions? why i needed to use a existing non logic named getitem for have index?
Magic methods in Python
Python
FineMouche
FineMouche
shared a Post
3 years ago
sectionslen(course)-1 = f_p i can't acces dirrectly to ..., (here), ...], t[a (why [b] disapears ? look the SC) don't work, i must use sections[len(
Moving around a polygone meth.1 (no graphic, only sets)
Python
Coder100
Coder100
hi, btw, you need 3 backticks and a new line in order to make a code block. I recommend reading this. 3 years ago
SixBeeps
SixBeeps
Values stored like this are called a tuple: (7, 2) Values stored like this are called an array: [6, 5] On line 15, you're setting the values in sections to a bunch of tuples, which don't support changing each individual value separately. In this case, I'd construct a brand new tuple and replace the current one with it: current = sections[len(course)-1] new = (current[0], f_p) sections[len(course)-1] = new Or, if the (lp, fp) tuple would do the same thing, do that. For the Python syntax in Ma3 years ago
FineMouche
FineMouche
shared a Post
3 years ago
i want make a program where a mobile/a collector path on each section/vertex and end to the Final point. ex : 0-1-2-0 (a triangle if you want) He s
Moving around a polygone meth.1 (no graphic, only sets)
Python
FineMouche
FineMouche
shared a Post
3 years ago
we know we just need to search until sqrt(n) for find a divisor of n so what i did bad in my second function ?
Finding prime numbers with for loops
Python
FineMouche
FineMouche
i update the tilte for more clarity3 years ago
FineMouche
FineMouche
i use for info for debug it, to i place it well ? (rest in for1 / rest in for2) image3 years ago
FineMouche
FineMouche
Please look if i made a upadte to my code before answer me.3 years ago
FineMouche
FineMouche
shared a Post
3 years ago
in "def reverse_expo():" : int(input("a : ")) make a compilation error when we just press enter (cause can't translate "void" into a int input(input
functions
Python
Codejira
Codejira
Hitting Enter on input results in an empty string. This can't be converted into an integer. One way to ensure valid integer input is while True: try: a = int(input("a = ")) except ValueError: print("Bad input, numbers only. Try again") else: break Another way is to define a default that replaces an empty string default = 0 a = input("a = ") a = default if not a else int(a) but this doesn't catch other bad input like letters. HTH3 years ago
Coder100
Coder100
How about this: num = input(">> ") try: num = float(num) except: print("invalid") now, it will either say input is invalid or work. A better solution would be: num = input(">> ") try: num = float(num) except: num = 0 # make it 0 now, the input is either the user's number, or 0. and now you can continue num += 2 num = num // 2 `3 years ago
octopyBot
octopyBot
when you do this try to use hope this helps and happy coding! >if you found this helpful, mark it as the correct answer3 years ago