I'm solving Python questions, but these three questions are hard
1) Let's write a program that reads integers and obtains sums and averages. However, the input of integers shall be made within the range where the sum does not exceed 1,000.
Execution Example
Add an integer.
How many more?:4
Integer: 213
Integer: 314
Integer: 613
The total has exceeded 1,000.
Ignore the last value.
The total is 527
The average is 263.5.
2) Let's write a program that determines whether it is a prime number by reading a positive integer. A prime number is an integer n that is not divided by any number underwater with 2 or more and less than n (i.e., a number divided only by oneself and 1).
Execution Example
An integer greater than or equal to 2:3
It's a minority
An integer greater than or equal to 2:14
It's not a minority
3) Let's write a program to find the product from 1 to n by reading the positive integer n.
Execution Example
positive integer:5
The product from 1 to 5 is 120.
For question 1, copy the method 1 introduced at
For the part "over 1000" in question 1, read and apply the section "Other Control Statement Break" in
For question 2, copy the code 1 introduced at
For question 3, copy the final answer from
Should I say it? Just ask Chat GPT to make it. Why do you have to solve these questions in the first place? There will be more areas in the world where you can feel more valuable and interested in yourself.
586 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
689 Uncaught (inpromise) Error on Electron: An object could not be cloned
671 GDB gets version error when attempting to debug with the Presense SDK (IDE)
1000 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.