daily log 12.29.20
PE: #16
num = 2**1000
num_sum = 0
digits = [int(d) for d in str(num)]
for n in digits:
print(n)
num_sum += n
PE: #15 was tricky
I got stuck here. I know I need to draw it out on paper.
How would I, as a human computer, solve this?
UMRR
<script type="text/babel" data-presets="env,react">
const App = () => {
return (
<div>
<Segment>
<div className="ui icon header">
<i className="pdf file outline icon"></i>
No documents are listed for this customer.
</div>
<div className="ui primary button">Add Document</div>
</Segment>
<Segment>
<h4 class="ui header">For Your Information</h4>
<p>
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
</p>
</Segment>
</div>
);
}
const Segment = (props) => {
return (
<div className="ui placeholder segment">
{props.children}
</div>
)
}
// Renders the App component into a div with id 'root'
ReactDOM.render(<App />, document.querySelector('#root'));
</script>
<!--The App component above will be rendered into this-->
<div id="root"></div>
<!--No need to change anything after this line!-->
<!--No need to change anything after this line!-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill.min.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://unpkg.com/@babel/preset-env-standalone@7/babel-preset-env.min.js"></script>
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
UMRR THREE THINGS:
- Class based components originally were the only ones that could access state (thanks to hooks, functional components can now, too!)
class extends
works like other Object Oriented Programming. It EXTENDS theReact.Component
class to add our own functionality. We can use the methods that React.Component comes with and then we can build off of it.- State is simply a JavaScript object with data about a single component.
- Updating state updates that component.
- State object can ONLY be updated using the function
setState