The goal of these exercises is to bring your Python programming skills to a level needed for the rest of the course.
Course on Internet of Things
Connect to your ESP32 with minicom or thonny.
Using REPL:
print “Hello World!”
read in a text using input() and print it
Calculate
Calculate sin(30°)
If you see errors, how do you correct them? Are the results correct?
Write a script that assigns the values 5 and 3 to the variables a and b respectively
Print the results of 4 basic arithmetic operations:
a+b
a-b
a*b
a/b
Improve this program asking the user to enter 2 integers separated by a space. If this happens when the user mistypes and enters something that is not an integer can you capture the error and simply ask him to repeat his input until you get 2 correct integer numbers?
Connect to your ESP32 with minicom or thonny.
Using REPL:
print “Hello World!”
read in a text using input() and print it
Calculate
Calculate sin(30°)
If you see errors, how do you correct them? Are the results correct?
Write a script that assigns the values 5 and 3 to the variables a and b respectively
Print the results of 4 basic arithmetic operations:
a+b
a-b
a*b
a/b
Improve this program asking the user to enter 2 integers separated by a space. What happens when the user mistypes and enters something that is not an integer?
Can you capture the error and simply ask him to repeat his input until you get 2 correct integer numbers?
Ask the user for 2 integer numbers. Check with one is bigger and print the result:
Running the program should result in output as shown below:
Ask the user for 2 integer numbers. Check with one is bigger and print the result:
Running the program should result in output as shown below:
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
calculations.png | r1 | manage | 2.3 K | 2020-05-03 - 09:22 | UliRaich | |
![]() |
conversionError.png | r1 | manage | 19.3 K | 2020-05-03 - 09:22 | UliRaich |