Larsis
Larsis
MModular
Created by Larsis on 9/14/2023 in #questions
Stackoverflow?
Does anyone know how to use Stack Overflow for mojo questions? The mojo tag on Stack Overflow has the following description: SDK for development of webOS 1.x and 2.x apps using JavaScript and HTML. or... Most commonly used to designate plugin development in Maven (Java build tool). For the Perl web toolkit, use [tag:mojolicious] Mojo is also a programming language and superset of Python. Check https://www.modular.com/mojo for more details. also:mojo-sdk
3 replies
MModular
Created by Larsis on 9/14/2023 in #questions
How to use Modulo?
This works print(10%) but I can't use % in a method:
def is_prime(n):
for i in range(2,n):
if (n%i) == 0:
return False
return True
def is_prime(n):
for i in range(2,n):
if (n%i) == 0:
return False
return True
How come I get the following error?
error: Expression [8]:7:10: 'object' does not implement the '__mod__' method
if (n%i) == 0:
~^

expression failed to parse (no further compiler diagnostics)
error: Expression [8]:7:10: 'object' does not implement the '__mod__' method
if (n%i) == 0:
~^

expression failed to parse (no further compiler diagnostics)
8 replies