• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Mar 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #switch from ben to charlie
2. def ben_to_charlie(ben_sequence):
3.   charlie_sequence = []
4.   print(ben_sequence)
5.   loops = len(ben_sequence)
6.   charlie_sequence.append(ben_sequence[0])
7.   for i in range (1, loops):
8.     thing1 = (charlie_sequence[i-1])
9.     thing2 = (ben_sequence[i])
10.     charlie_sequence.append(thing1 + thing2)
11.
12.   print("charlie's sequence is\n", charlie_sequence)
13.
14. #switch from charlie to ben
15. def charlie_to_ben(charlie_sequence):
16.   ben_sequence =[]
17.   print(charlie_sequence)
18.   loops = len(charlie_sequence)
19.   ben_sequence.append(charlie_sequence[0])
20.   for i in range (1, loops):
21.     thing1 = charlie_sequence[i]
22.     thing2 = charlie_sequence[i-1]
23.     ben_sequence.append(thing1 - thing2)
24.   print("ben's sequence is", ben_sequence)
25.
26. #input and store their sequence as an array
27. sequence_length = int(input("how long is your sequence? "))
28. their_sequence = []
29. for i in range (sequence_length):
30.   their_input = int(input("input sequence "))
31.   their_sequence.append(their_input)
32.
33.
34. #choose which function to run on sed array
35. switch = int(input(" Do want to change this sequence from \n (1) ben --> charlie / ana --> ben \n or \n (2), charlie-->ben / ben-->ana \n"))
36. if switch == 1:
37.   ben_to_charlie(their_sequence)
38. elif switch == 2:
39.   charlie_to_ben(their_sequence)
40. else:
41.   print("invalid response")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top