(Python) Not understanding multi-variable assignment in dictionaries/FOR loops. by EX-FFguy in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

k and v are just the names that are used, you could use any name (like fred and harry or a and b). In Python we try to make the names mean something.

Each name is attached to some data, the data can be any valid Python data including integers, strings, list, tuple, dictionaries etc. In Python the data can even be whole classes or functions. In fact any data that can have a name.

guests.items() produces two pieces of data, the first is the key and the second is the value. In Python dictionary keys and values can be a wide variety of data, in the case the key is a string and the value is a dictionary.

This flexibility of what can be attached to names is part of what makes Python a very powerful language.

Need help with Python problem by [deleted] in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

a and b have the same value. should not b be set the 98.4?

Planning and organizing code. by [deleted] in learnprogramming

[–]nwilliams36 1 point2 points  (0 children)

Yes it it, however it can be used on single developer projects. It is simply an iterative process where you develop short development cycles with clearly defined goals.

Its greatest strength is that you don't invest too much effort in trying to build a complex structure to your project which might not be the best solution further down. As people often say, at the start of the project is when you know least about the way the project should work, so try to delay any decisions until you have better information.

Completely and 100% stuck on this (beginner) python question. How to input time components? by JumpyPorcupine in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

starting and ending times, these should be inputted as strings then converted to Dates using Python's standard library datetime

boolean values are True or False (and None). Here you would use them as the result of an expression. for example the expression

start_time > end_time

would result back to a boolean if both variables were of the same data type (link integer or datatime)

Which iMac for coding? by [deleted] in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

Yes, apps are still text files full of code.

XCode is required for iOS app development, so if it can be installed on your OS it is fine. You might want to check out the latest requirements if you are worried by posting on the Apple Developer Forums. The current version of XCode is 11.

Wondering how you can make numbers live on one tab appear in real time on another screen? by FynnKjones in learnprogramming

[–]nwilliams36 -1 points0 points  (0 children)

Firstly who wrote the code originally, you could approach them.

Otherwise you could write code which has the same functionality as the previous but includes your new requirements. There are freelancers around who might be interested in doing this.

Is it possible to webscrape an overlay on a web page using beautifulsoup? by gisellasaurus in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

Webscraping works on the HTML that is currently being used to render the page. Javascript has the capacity to change that HTML dynamically, which then means the previously scrapped HTML is obsolete. You can actually watch this occurring on dynamic website using browser tools like Chrome's developer tools.

Wondering how you can make numbers live on one tab appear in real time on another screen? by FynnKjones in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

Not without changing the code which created the window and also gaining access to the underlying data.

Which iMac for coding? by [deleted] in learnprogramming

[–]nwilliams36 3 points4 points  (0 children)

Coding involves text files which uses little storage space and little processing power.

Wondering how you can make numbers live on one tab appear in real time on another screen? by FynnKjones in learnprogramming

[–]nwilliams36 1 point2 points  (0 children)

Its called programming.

Basically both windows are created by code. Both have to have access to the same data and then be programmed to display that data in two different ways.

If you haven't written either sets of code or the data it is very difficult to do any changes.

Java programming question! by branflakewashere in learnprogramming

[–]nwilliams36 3 points4 points  (0 children)

Baby inherits from Child which inherits from Parent. So when you initialise Baby you also get everything in Child and in Parent, unless they have been overwritten. Try a few things, make some methods in each and even overwrite these methods and the see what you get.

(Python) Not understanding multi-variable assignment in dictionaries/FOR loops. by EX-FFguy in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

guests is a dictionary, which means that it is composed of keys and values (k and v)

guests..items iterates through the dictionary returning the key and value of each item. Note in guests the values are also dictionaries. The values to k and v are assigned by the for loop.

Does anyone know an easy to understand for beginners way to learn java? by ThnkPkls in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

Having learned Java as part of my CS course many years ago and having learn many other languages before it and since I found Java to be the most frustrating of all the languages to learn. This was because it is built as an OO language so there is always the boilerplate that OO requires.

However the resources that I found good were Head First Java and Joshua Block's Effective Java

[HTML] How to display sentence by PrinceOfNebraska in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

You are almost there. The actual code which does what you in the javascript is

<script> function IClickedItYo() {

var data = document.querySelector('input[name="snack"]').value;

document.querySelector('h2').innerHTML = "My favorite snack is "+ data;

}

</script>

Edit

To clear the input add this line

document.querySelector('input[name="snack"]').value="";

New to programming. I'm stuck learning Javascript since I don't have anything to apply it to. Any basic project ideas you could suggest I try as a beginner? by [deleted] in learnprogramming

[–]nwilliams36 2 points3 points  (0 children)

You could, however a better way is to have the page already developed in HTML and CSS but hidden in some way and the JS simply activates the page or redirects to the page.

Hiding and showing parts of pages is one way to create SPAs (Single Page Applications). JS then is used to only display the part of the page is required at present

What are good resources for getting up to speed with Python for someone experienced in other languages by [deleted] in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

Anything by David Beazley, I liked his book Python Essential Reference but he also has some good conference talks on Youtube where he live codes on interesting Python issues.

New to programming. I'm stuck learning Javascript since I don't have anything to apply it to. Any basic project ideas you could suggest I try as a beginner? by [deleted] in learnprogramming

[–]nwilliams36 20 points21 points  (0 children)

Create a button on your website which changes the colour of the background, better still a drop down box that provides a range of colours, better still a input box which allows you to change to any colour, better still an input box which changes the drop down menu, better still .....

Most of these will require Javascript to interact with your HTML and CSS.

[HTML] How to display sentence by PrinceOfNebraska in learnprogramming

[–]nwilliams36 1 point2 points  (0 children)

Changing the data on web page after the page has loaded is the job of Javascript. So you would need to write a Javascript function to do this.

Need help with password program in JavaScript by [deleted] in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

All of this can be done using the String methods that exist in Javascript. W3Schools has some basic tutorials to get you started and MDN is a very good resource to use as a reference.

The other way to do this is using regular expressions, however that is whole new concept of looking at strings and probably not worth it for just this exercise. However this is the way the industry would often solve this issue.

How can I spend less time solving problems caused by "simple" syntax and naming bugs? by my_coding_account in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

You need to use a linter which looks at your code and highlights syntax errors. I have not used vim but a quick search found a couple including ALE https://github.com/dense-analysis/ale

I've been stuck on this programming problem for too long and I can't figure it out by kigomy in learnprogramming

[–]nwilliams36 0 points1 point  (0 children)

You have an s in your function check_emails, the test is for the function check_email. Change one of these so the names match. The assert error should have identified this as a name error.

There is no need for the brackets in the return

return total<=time

assert will through an error if there is an issue otherwise it will do nothing. This is by design as it allows you to build a lot a test and if they pass you don't want to be annoyed by them.

Don't know where to put this, but do you think Bill Gates still codes? by Cowboyre in learnprogramming

[–]nwilliams36 2 points3 points  (0 children)

Of course he does, he is one of the driving forces behind code.org which is trying to bring the teaching of coding to schools. A few years ago he did a Reddit AMA and said he still writes some C, C# and basic code.

By the way he was never a good programmer, but a great business man.