xxxxxxxxxx
#you can get a visualization of your code at python tutor
#below there is a function that is suppossed to mutate a list
#and multiply it by 2
#using pythontutor.com copy the code below into python tutor, then follow steps
#step 1: click visualize execution
#step 2: hit next for each line of code and find the problem
#step 3: click on the line with the problem code to add a break point.
#step 4: hit next, or click the red line on the bar
#step 5: fix the code, comment and thank if this helps!
def mutate(a_list):
b_list = []
for item in a_list:
new_item = item * 2
b_list.append(new_item)
print(b_list)
mutate([1,2,3,5,8,13])
xxxxxxxxxx
import pdb
def addition(a, b):
answer = a + b
return answer
pdb.set_trace()
x = input("Enter first number : ")
y = input("Enter second number : ")
sum = addition(x, y)
print(sum)
xxxxxxxxxx
import random
num,name,gueses=random.randint(1,100),input("Hello, What's your name?"),10
print('Okay!'+name+'guess a number between 1 and 10:')
while guesses<10:
user_guesses=int(input())
guesses+=1
if user_guess < num:
print('your guess is too low')
if user_guess>num:
print('your guess is too high')
if user_guess==num:
break
if user_guess=num:
print('You guessed the number in'+str(guesses)+'tries')
else:
print('Sorry,Actually the number was'+str(num))