Python zum JavaScript -Konverter online
for i in arr:
if i==num:
num=num*2
return num
Plain Peacock
for i in arr:
if i==num:
num=num*2
return num
pen = turtle.Turtle()
pen.color("yellow")
pen.width(3)
pen.hideturtle()
pen.penup()
pen.goto(-30, 60)
pen.pendown()
pen.fd(60)
pen.rt(90)
pen.fd(120)
pen.rt(90)
pen.fd(60)
pen.rt(90)
pen.fd(120)
n = 0
while n <= 0:
n = int(input("Enter the number of lines: "))
for i in range(1, n+1):
print('*' * i)
x = 3
print(x)
def StringPeriods (s):
for i in range (int (len (s)/2), 0,-1):
a = s[i] count = 2
b = "
while len (b)
b = a * count
if b == s:
return a
len(s):
count += 1
return -1
class Solution:
def solve(self, s):
x = ""
for i in s:
if i >= 'a' and i <= 'z':
x += i
i, j = 0, len(x) - 1
while i <= j:
if x[i] != x[j]:
return False
i += 1
j -= 1
return True
pen = turtle.Turtle()
pen.color("yellow")
pen.width(3)
pen.hideturtle()
pen.penup()
pen.goto(-30, 60)
pen.pendown()
pen.fd(60)
pen.rt(90)
pen.fd(120)
pen.rt(90)
pen.fd(60)
pen.rt(90)
pen.fd(120)
pen = turtle.Turtle()
pen.color("yellow")
pen.width(3)
pen.hideturtle()
pen.penup()
pen.goto(-30, 60)
pen.pendown()
pen.fd(60)
pen.rt(90)
pen.fd(120)
pen.rt(90)
pen.fd(60)
pen.rt(90)
pen.fd(120)
n = 0
while n <= 0:
n = int(input("Enter the number of lines: "))
for i in range(1, n+1):
for j in range(1, i+1):
print('*', end='')
print()
if g == 0:
return [1] * len(originCities)
if g >= n:
return [0] * len(originCities)
components = {i: i for i in range(g + 1, n + 1)}
for candidate in range(g + 1, n + 1):
current = [t * candidate for t in range(1, n // candidate + 1)]
current_components = [components[e] for e in current]
minone = min(current_components)
for curr in current:
components[curr] = minone
res = []
for k in range(len(originCities)):
origin, destination = originCities[k], destinationCities[k]
if origin > g and destination > g and components[origin] == components[destination]:
res.append(1)
else:
res.append(0)
return res