the minus calculation doesn’t work because I haven’t learned how to do negative numbers yet. or loops. that’s next. <!DOCTYPE html> <html> <body> <h2>second game</h2> <script> var num1 = 0 var num2 = 0 var numplus = 0 var numMinus = 0 var numTimes = 0 var numDiv = 0 num1 = prompt (“Can youContinue reading “JS program 3 – more complicated than 2 (it does some calculations, that’s all)”
Category Archives: code
2nd decent program in JS
<!DOCTYPE html><html><body> <h2>second game</h2> <script>var num1 = 0var num2 = 0var num = 0 num1 = prompt (“Can you please give me a number?”);num2 = prompt (“How about a second number?”); num1 = eval(num1);num2 = eval(num2);num = num1 + num2; alert (“the total of your two numbers is ” + num);</script></body></html>
program 3 of the new journey
my second program in JS
There is a flaw in the program. But that is on purpose. The book created a flaw so you can learn to see errors. This error is that there is a concatentation done by the computer, treating the numbers as strings and adding them instead of adding the tip to the meal price as aContinue reading “my second program in JS”
My first program in Javascript
Since the new start of my coding adventure. Read 12 pgs yesterday. Finished putting together my first exercise and after a few bug fixes and finding w3schools to use the blank html page compiler; here’s my code for my first program:
Total Car Price (#3 in Python)
carPrice = input (“what is the base price of the car?”) tax = int (carPrice) * .125insurance = 250totalcarPrice = int (carPrice) + int (insurance) + int (tax) print (“total cost of your car including: insurance $”,insurance,”,”)print (“and tax: $”,tax,” comes to $”,totalcarPrice)input () This is a program that figures out all your extra costs,Continue reading “Total Car Price (#3 in Python)”
my 2nd program in Python
tip15 = 0tip20 = 0price = input (“how much did your meal cost?”)tip15 = int (price) * .15tip20 = int (price) * .2print (“A 20% tip would be “,tip20,” and a 15% tip would be”,tip15)input () I wrote a tipper program for an exercise.It’s a simple program and it took 20mins to write including severalContinue reading “my 2nd program in Python”
first program of a new adventure
I wrote my first program (not including the false start last time I attempted programming) in Python… and it works! after a few bug fixes it’s actually quite small and some would think insignificant. But I’m getting used to the syntax and form of the language. print (“hello”) print (“nwhat are your 2 favourite foodsContinue reading “first program of a new adventure”
my first three Python scripts
1 inventory = [“sword”, “Shield”, “Charm”, “Luck”]spent = “”word = “”import randomwhile inventory != “”: word = random.choice(inventory)print (word)spent = spent+word if word in spent:inventory.remove(word)else:print(“/n”) input (“press a key”) What this program does is select a word at random from a list.Then it displays the word.It then selects another word, it will not select theContinue reading “my first three Python scripts”
my first real Javascript program – “the name game”
copy and paste it into an entirely blank html doc/web page or a notepad++ save it as HTML then open it to run it automatically in browser. If you want to share code, the easiest way is to upload it to a server and share the link. <!DOCTYPE html> <html> <head> <meta charset=”UTF-8″> <title>name game</title>Continue reading “my first real Javascript program – “the name game””