I want to generate random numbers then do the addition operation on them

Pranay Kumar

I am 9 year old kid trying to automate the random numbers maths toward my abacus.

I want to generate values randomly and store them in memory for later ,when i press to check for addition. then it should give the addition value of all the random numbers.

so far I have this code

# my abacus training app

import random
import time

print ('hey what\'s your name')
name = input()

print("well today i am goingto ask abacus questions ")

print ("choose a level")
levelOne = print ("level 1")
print (levelOne)

choice = input()

if choice.endswith("1") :
    print("let's start")
    noone = random.randint(1,10)
    print (noone)
    time.sleep(5)
    notwo = random.randint(1,10)
    print (notwo)
    time.sleep(5)
    nothree = random.randint(1,10)
    print (nothree)
    time.sleep(5)
    nofour = random.randint(1,10)
    print (nofour)
    time.sleep(5)
    nofive = random.randint(1,10)
    print (nofive)
    time.sleep(5)

=======I am posting Final Answer for above question, this was my final code, Thanks to Srig and Hamed Temsah for the inputs=== thanks to everyone who supported me.

# my abacus training app

import random
import time

print ('hey what\'s your name')
name = input()

print("well today i am goingto ask abacus questions ")

print ("choose a level")



choice = input("choose a level : ")

if choice.endswith("1") :
    print("let's start")
    noone = random.randint(1,10)
    print (noone)
    time.sleep(10)
    notwo = random.randint(1,10)
    print (notwo)
    time.sleep(10)
    nothree = random.randint(1,10)
    print (nothree)
    time.sleep(10)
    nofour = random.randint(1,10)
    print (nofour)
    time.sleep(10)
    nofive = random.randint(1,10)
    print (nofive)
    time.sleep(10)
    print ("click enter to check your ans")
    input ()
    print(noone+notwo+nothree+nofour+nofive)
    

Hamed Temsah

Great job 9 year old kid, you did a great job! If I understood your question clearly, you want to ask the user to input another character after generation of these 5 random numbers. If it had the character '+' , then you should print summation of all these random numbers, you can re-use your own code to achieve this like:

operand = input()
if operand.endswith("+") :
    print(noone+notwo+nothree+nofour+nofive)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I want to generate 5 random numbers using 5 Threads(each thread generates 1 number) and then to sum up the numbers and print the sum of them

How do I generate random numbers in Dart?

I want to generate random numbers within given range in java

I want to create a C++ program to generate random numbers into a file

How do i generate random 1 digit numbers and then add them in each cell of a datagridview in c# window form application?

How do I generate random quiz questions and score them?

How to do an addition from random numbers by the user?

How do I generate random numbers to fill in empty rows?

How do I generate random numbers x times?

How do I generate a vector of random numbers in a range?

How do I generate random numbers with a mean in C++?

How do I generate thread-safe uniform random numbers?

How do I generate random but unique numbers in python?

How do i generate a random numbers for each integer in an array?

How do I generate different random numbers in a loop in C?

How do I generate a random range of numbers within another range?

How do I generate a random list in Python with duplicates numbers

How do I generate a specific amount of random numbers?

I am generating random numbers from 1~10, but I want to give number 8 high priority, so that 8 number should generate more times, how can I do this?

I want to change random numbers from the list of them to the minimal meaning of list

How do I use random numbers to generate truly random results? ABS(CHECKSUM(NewID))) is not working

JS addition game: how do I display 4 possible answers, 3 of them are random and 1 is the correct answer ? (Codepen included)

generate random numbers within a range with a percentage of them a specific value

Generate a random amount of numbers and sort them with bubble sort

How do computers generate random numbers

I want to generate a random list of set strings from an array without duplicates, not sure how to do the duplicates part

How do I generate non-repeating random numbers in a while loop? (Python 3)

How do I generate random numbers in an array that add up to a defined total?

How do i generate 2 random numbers, once within the range of 50 and 259, and once within 50 and 159?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive