Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
A website built out of jupiter
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
y=[1,2,3]
x=[50,60,30]
plt.plot(x,y)
plt.show()
n=input()
list1=[]
for i in n:
if i.isdigit():
list1.append(i)
x=str(list1[5:9])
y=str(list1[-4:])
diff=abs(int(x)-int(y))
if diff==0:
print('1')
else:
print(diff)
#print(list1)
soon after the world war 2 ended on 02-09-1945 the un was on 24-10-1945
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-13-13668d6d1d1b> in <module>
6 x=str(list1[5:9])
7 y=str(list1[-4:])
----> 8 diff=abs(int(x)-int(y))
9 if diff==0:
10 print('1')
ValueError: invalid literal for int() with base 10: "['1', '9', '4', '5']"
def reduce(n):
n=n-5
return n
def increase(n):
n=n+5
return n
t=int(input())
while(t!=0):
n=int(input())
str1=str(n )+str(' ')
if n==0:
str1+=increase(n)
if n==-1:
str1+=increase(n)
str1+=str(reduce(n))
print(str1)
t-=1
1
16
16 11