We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
''' | |
This program is designed for the original Python 3 | |
and not for Python 2. Check out the original program | |
which is designed for Python 2. | |
Also check out my dice program fr the BBC MicroBit | |
here - | |
https://gist.github.com/rudrathegreat/f42e1ca01c81ea9973e4653b60c16085 | |
https://gist.github.com/rudrathegreat/ed7db24af713ae8d42444bc0816d19c6 |
from random import randint | |
for x in range(10): | |
print random() | |
print('=============================') | |
z = ['ciao', 'piccolo', 'bambino', 'sono', 'qua', 'io', 'in verita'] |
## Error handling in Python is done through the use of exceptions that are caught in try blocks and handled in except blocks. If an error is encountered, a TRy block code execution is stopped and transferred down to the except block, as shown in the following syntax: | |
data = 'Hello and welcome to Earth (if you are an alien)' | |
try: | |
f = open("test.txt") | |
except IOError: | |
print("Cannot open file.") | |
## In addition to using an except block after the try block, you can also use the finally block. The code in the finally block will be executed regardless of whether an exception occurs. |