Posts

Showing posts from December, 2022

Week 13

Image
Below is a copy and paste of my code in python and java. Interestingly enough it made the background and colors the same as my IDE. Hopefully, this is better than my copy pastes in the past so you can see the code much better, I think. This python code is for my minilab 2. I came into this thinking this would be easy enough and it sorta was until I got to coding random integers to fill an array. Everything else was more or less review from what I did in the first one but I needed to look up how to initialize random class. I did that and came across a bit of a hold up when my code worked but it printed the same number( when I used the randint that I learned in an article). EX 3,3,3,3 (if array size was 4 and seed was 3). From there I tried to look up how to fill an array with random unique numbers and I came across a you tube video that was helpful until I ran the code and it was working because my tempRand was making my boolArray go out of bounds with the index. After many fixes and re...

Week 12

Image
  This week I felt a sudden urge to try to convert my minlab1 into python to try to learn the language. The first photo is the python code and the second is the java that I did during 205. As you can see in the code it is very different in java then in python. You can sorta till the idea and goal is the same but the code and grammar is different. Python needs no semi colons, which is so weird but convenient because its one less thing I need to worry about. Print doesnt need the system.out. I need to my int variables in to string in order to print, which is interesting. Conditional statements done need parenthesis and after its condition there is a colon instead of a pair of brackets. Input is set to take  in string so I was getting a lot of errors until I found out you have to type cast it to an int. Conveniently, it makes the left side variable a float if the right has division. Down below we see the results when given the same data. In addition to this little side quest, we ...