Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ll21215/apt_exercises
  • hb09106/apt_exercises
  • afischer/apt_exercises
  • sm27496/apt2020
  • ia19390/apt_exercises
  • pk02862/apt_exercises
  • cd28198/apt_exercises
  • ma05240/apt_exercises
  • jp01114/apt_exercises
  • mf19908/apt_exercises
  • an25923/apt_exercises
  • ma18960/apt_exercises
  • fa30968/apt_exercises
  • jg08184/apt_exercises
  • gs27324/apt_exercises
  • ss18986/apt_exercises
16 results
Show changes
Commits on Source (2)
Showing
with 41 additions and 0 deletions
b="00123456"
i=0
temp1=0
while i<len(b):
a=b[i]
a=int(a)
temp1=temp1+a
i+=1
print(temp1)
c=input("Please enter a number: ")
j=0
temp2=0
while j<len(c):
d=c[j]
d=int(d)
temp2=temp2+d
j+=1
print(temp2)
x=temp1-temp2
print("The difference is:", x)
def myfunc(values, value, next):
"""
This function will search an item in a list of values and return the neighbouring value -- either the successor or the predecessor.
"""
# First: find the position of value
i = -1
for j in range(len(values)):
v = values[j]
if v == value:
i = j
# If next == True get the successor
if next:
if i < len(values) - 1:
k = i + 1
return values[k]
else:
if i > 0:
l = i - 1
return values[l]