This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = [0,1,2,4] # can change the list | |
def check_seq(liste): | |
liste = iter(liste) | |
if (1 in liste): #Check if first sequence item is in list and start iterating when we have a match | |
if liste.__next__() == 2: # check next item | |
if liste.__next__() == 4: # check next item | |
return True # sequence found | |
else: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addItem(product){ | |
// Get current list of products | |
let products = this.state.products | |
let idx = this.state.products.indexOf(product) | |
// Update the total price by quantity * price of the added product | |
let totalPrice = this.state.totalPrice + (product.price * product.quantity) | |
if (this.state.products.indexOf(product) !== -1) { | |
products[idx].quantity += 1; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addItem(product){ | |
// Get current list of products | |
let products = this.state.products | |
let idx = this.state.products.indexOf(product) | |
// Update the total price by quantity * price of the added product | |
let totalPrice = this.state.totalPrice + (product.price * product.quantity) | |
if (this.state.products.indexOf(product) !== -1) { | |
products[idx].quantity += 1; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextInput | |
placeholder="Address" | |
maxLength={50} | |
onChangeText={streetName => this.setState({ streetName })} | |
/> | |
<TextInput | |
placeholder="City" | |
maxLength={58} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class Delivery extends Component { | |
state = { | |
streetName: undefined, | |
postcode: undefined, | |
city: undefined | |
}; | |
constructor(props) { | |
super(props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
display: "flex", | |
flexDirection: "column", | |
justifyContent: "center", | |
alignItems: "center", | |
maxHeight: 400 | |
}, | |
inputStyle : { |