seb16120
@FineMouche
26Y.O bad self learner for some reasons.
0
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 issue1
1
0
0
how change the fill color without it be random ?
i want change it gradually but all try i made failed ...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
6
4
0
1
why =+ don't work with tuples ?
like in friends =+ ("Seb",)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
2
10
1
it say : "ImportError: cannot import name 'cache' from 'functools' (/usr/lib/python3.8/functools.py)"
Python
i tried something L10 but it didn't worked
edit : i fix my issue with :
import os
os.environ['TZ'] = 'Europe/Paris'
time.tzset()
Python
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
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 ?
Python
FineMouche ok, so by not answered me, what i should understand ? That i must search even more on google ?2 years ago
I tried with a for in for but i fail.
Python
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
Python
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 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
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
Python
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
i followed this video to make a chess board : https://www.youtube.com/watch?v=D_OiVkIgyGE
Python
@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
Python
SixBeeps Here's the Repl, taken straight from the Repl name: https://repl.it/@eankeen/pygame-moving-dvd-logo2 years ago
i tried 4 differents method to do it but all method give me a error :/
Python
1) don't use it,
2) make your "future" argument = None first.
Python
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
Python
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
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
Python
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 "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
Why it's seems only to be preset functions?
why i needed to use a existing non logic named getitem for have index?
Python
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(
Python
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 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
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
Python
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 ?
Python
FineMouche i use for info for debug it, to i place it well ? (rest in for1 / rest in for2)
image3 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
Python
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 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 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