5

the cs50.h that I have does not have a function: get_long_long(), so, for me, the code does not compile. My compiler suggested: getlonglong() which credit card company is, normally, contained in the left digits of the card number, not in the right digits. so the posted code logic is (probably) not correct. The posted code fails to take into account the ...


4

Usage of requests Strongly consider replacing your use of bare urllib with requests. It's much more usable. Among other things, it should prevent you from having to worry about an SSL context. Type hints def is_downloadable(url): can be def is_downloadable(url: str) -> bool: And so on for your other functions. Boolean expressions content_type = ...


4

Welcome to CodeReview! Style Guide You mentioned that you think your code looks "ugly". This problem can be solved by reading a style guide (Google Style Guide). Some important points: Use proper intendation Although you can use empty lines to structure your code, it is not useful to have empty lines after every line of code. Use useful names (public ...


4

it is a bit hard to compare it with "standard code" if you only worked through first two chapters ;) You should consider three principles in the following order: The code should work The code should be readable The code should be extendable Only the 1st is proofable. But maybe not that easy as one might think. Consider edge cases and errors. It takes some ...


3

The question is do you think I can code? Become a programmer ? I mean do I have the right mind for it ? do you think I'm any good at this? Yes, but code review is more on the code than the programmer. I know the style is awful and the code is very messy too, but your opinion is very important to me. Use an auto formatter. Many coding environments ...


2

Except the formatting, your code does not looks ugly. It just looks procedural. Try to create classes for each roles. One that read and write to the console. One to compute the loan. And another to control the flow of your program. As said by Martin Fowler, "Any fool can write code that a computer can understand. Good programmers write code that humans ...


2

I just found a really clever solution to this (not mine): All credit goes to ViolaCrellin: using System; using System.Linq; using System.Collections.Generic; public class JosephusSurvivor { public static int JosSurvivor(int n, int k) { if (n == 1) return 1; else return (JosSurvivor(n - 1, k) + k-1) % n + 1; ...


2

A note on terminology, 14 has factors [1, 2, 7, 14] Usually these are called divisors, while the factors of 14 are taken to be only 2 and 7. The Algorithm While it is not entirely clear to me what you need the result to be, there is an alternative approach to finding the answer to the following question: Does the number have any factors that are not ...


2

I like that you are trying to not use explicit recursions everywhere. That being said, there are a few standard functions that we could use to get a code similar to the following. import Data.List(intercalate) grid :: Int -> [String] grid n = [intercalate " --- " . take n . drop (n-k) $ osxs | k <- [1..n]] where osxs = replicate n "O" ++ ...


1

Just one contribution from me: you can get rid of redundant declarations and make your code lighter. The newspapers should be defined just once and then reused. You are almost there. Build a list of dictionaries (or use a database). # dictionary for newspaper names and their links newspapers = ( {"name": 'Economic_times', 'url': 'https://dailyepaper.in/...


1

Pity no one has tried to help out a beginner. While I know little of Unity, I can offer some C# comments. Let me start with that overall your code looks nice. It has good indentation and variable names are meaningful, i.e. not cryptic or abbreviated. Use of braces is very good. Actually, I don't see any properties in your class, but that might be a ...


Only top voted, non community-wiki answers of a minimum length are eligible