Search first in Wikipedia what is the ‘Golden Ratio’. And then write in PythonAnyware (PA) golden_ratio.py (Exercises folder) with only two lines of code. 1. The first one to define this: 2. The second one to print the number Finally, Read More …

What does the print function do in Python?

What are functions in Python?

Now it’s your turn to try! Give this a go yourself. Use Python to calculate: Naming the file in PythonAnywere (PA) first_operation.py and saving it in the Exercises folder. Write the solutions below, typing them without decimals.

Give it a try yourself! In the following script, change the values of ‘color’ and ‘thing’ to have the computer output a different statement than the initial one. color = “Red” thing = “Blood” print(color + ” is the color Read More …

Write this code in PythonAnyware, save it as hello.py in the Exercises folder and run the program print(“I’m programming in Python!”)   Copy and paste the text that the compiler writes in the lower black box, and when you have Read More …

Select the Python code snippet that corresponds to the following Javascript snippet: for (let i = 0; i < 10; i++) { console.log(i); }   1. for a in 1..5 do puts i end   2. for (i in x) Read More …

What is the correct form to put “This is fun!” onto the screen 5 times? 1. for i in range(5): print(“This is fun!”)   2. for i in range(5): print(“This is fun!”)   3. for i range (5): print(“This is Read More …

Convert this Bash command into Python: echo Have a nice day   What are the correct answers? 1. print ‘My first Python program’ 2. print (‘My first Python program’) 3. print (“My first Python program”) 4. print “My first Python Read More …