How I finally got a Python Flask app installed on Cpanel

In summary:

1. Check versions! Of Python, Flask and Jinja
2. Read this really useful tutorial https://dev.to/lordghostx/how-to-host-flask-applications-on-namecheap-cpanel-299b (Thanks LordGhostX)

Okay so I’ve been meaning to figure this out for a while. Flask is a good library for letting students use the power of Python as a back end to the graphical niceties of HTML,CSS and Javascript. But we’ve been stuck to using it on Replit or Glitch which, being public sites, aren’t ideal for students who are doing their final year project and suffer the other issues of remotely hosted IDEs. So I was always interested in finding another way. Read more…

Python exercises in the browser from Data Camp



#use the variables below to print out "Hello Laura"
name = "Laura"
greeting = "Hello"

print out "Hello Laura"

name = "Laura"
greeting = "Hello"


print(greeting +" "+name)


test_function("print")
success_msg("Good stuff!")


Put variables into a print function

https://github.com/datacamp/datacamp-light-wordpress



#print the numbers 0 to 19

print the numbers 0 to 19

for i in range(10):
print(i)


for i in range(20):
print(i)


success_msg("Good stuff!")


Change the 10 to 20

Heads Tails Heads – probability problem

Problem:

  1. Write a problem to simulate the tossing of a sequence of successive coin tosses.
  1. Search the suitably generated sequence to find a particular pattern, e.g., HTH. Report where this sequence was found – after how many flips in the generated sequence. Allow the user to enter the pattern to look for via the UI (User Interface).
  1. Modify your program to repeat steps 1 and 2 a variable number of times; allow the user to specify this value in the UI. Each repeat should use the same search pattern, but a new sequence of source coin tosses.
  1. Modify your program to keep track of where the pattern was found in each generated sequence. Report the overall average number of coin tosses required to the find the search pattern across all of the repeats.
  1. If your program is correct, you will find that the average number of tosses necessary to find the search pattern HTH is 10, however, HTT it is 8. Why is this (this is another conditional probability problem)?

Read more…