1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bearhunter [10]
3 years ago
5

Answer this correct and get brainly

Computers and Technology
2 answers:
Leya [2.2K]3 years ago
5 0

Pseudocode:

import random

fetch user input on a lucky number

insert input into variable - "response"

new variable, random = randint

condition to check wheather random is our response

display results

Python Code:

import random

def main():

response = int(input("Guess my lucky number, its between 1 and 100: "))

lucky_number = random.randint(1,100)

if response == lucky_number:

print(f"Wow you're right, it is {lucky_number}")

else:

print("Sorry, Try Again")

main()

Reminder:

intended for python3 as i included the format f

also it could be done without the import, just manually insert a number

i'll leave the post mortum to you

solniwko [45]3 years ago
4 0

Answer:

Pseudocode:

import random

fetch user input on a lucky number

insert input into variable - "response"

new variable, random = randint

condition to check wheather random is our response

display results

Python Code:

import random

def main():

response = int(input("Guess my lucky number, its between 1 and 100: "))

lucky_number = random.randint(1,100)

if response == lucky_number:

print(f"Wow you're right, it is {lucky_number}")

else:

print("Sorry, Try Again")

main()

Reminder:

intended for python3 as i included the format f

also it could be done without the import, just manually insert a number

Explanation:

You might be interested in
Purpose of this project is to increase your understanding of data, address, memory contents, and strings. You will be expected t
STALIN [3.7K]

Answer:

See explaination for the details

Explanation:

#Starting point for code/programm

main:

la $a0,newLine #Print a new line

li $v0,4

syscall

# Find the number of occurence of a string in the given sentence

la $a0,prompt1 # Prompt the user to enter the first string.

li $v0,4

syscall

li $v0, 8 # Service 8 = read input string

la $a0, fword

li $a1, 9

syscall

la $a0,prompt2 # Prompt the user to enter the second string.

li $v0,4

syscall

li $v0, 8 # Service 8 = read input string

la $a0, sword

li $a1, 9

syscall

# process first word

li $t4,0 # Intialize the couter to 0

la $t0,sstatement # Store the statement into $t0

nstart1: la $t1,fword # Store the search word into $t1

loop1: # loop1 finds the number of occurences

# of input word in the given statment

lb $t2,($t0) # Load the starting address(character) of

# sstatement into $t2

lb $t3,($t1) # Load the starting address of input word

# into $t3

beq $t3,'\n',inc_counter1

beqz $t3,inc_counter1 # If $t3 is null , exit loop and print output

beqz $t2,print_output1 # If $t2 is null , exit loop and print output

move $a0,$t2 # Convert $t2 to lower, if it is upper case

jal convert2lower

move $t2,$v0 # Store the return($v0) value into $t2

move $a0,$t3 # Convert $t3 to lower, if it is upper case

jal convert2lower

move $t3,$v0 # Store the return($v0) value into $t3

bne $t2,$t3,next_char1 # If both characters are not matched current

# character in the string, go to next character

addiu $t0,$t0,1 # otherwise, increment both indexes

addiu $t1,$t1,1

j loop1 # go to starting of the loop

next_char1:

la $t5,fword

bne $t5,$t1,nstart1

la $t1,fword # Store the input word into $t1

addiu $t0,$t0,1 # Increment the index to goto next character

j loop1 # go to starting of the loop

inc_counter1:

addi $t4,$t4,1 # Increment the frequency counter by 1

la $t1,fword # Store input word into $t1

j loop1 # go to starting of the loop

print_output1:

la $t0,fword

L1:

lb $a0,($t0)

beq $a0,'\n',exL1

jal convert2upper

move $a0,$v0

li $v0,11

syscall

addiu $t0,$t0,1

j L1

exL1:

la $a0,colon

li $v0,4

syscall

la $a0, dash

li $v0, 4

syscall

move $a0,$t4

li $v0,1

syscall # print new line

la $a0,newLine

li $v0,4

syscall

# process second word

li $t4,0 # Intialize the couter to 0

la $t0,sstatement # Store the statement into $t0

nstart2: la $t1,sword # Store the search word into $t1

loop2: # loop1 finds the number of occurences

# of input word in the given statment

lb $t2,($t0) # Load the starting address(character) of

# sstatement into $t2

lb $t3,($t1) # Load the starting address of input word

# into $t3

beq $t3,'\n',inc_counter2

beqz $t3,inc_counter2 # If $t3 is null , exit loop and print output

beqz $t2,print_output2 # If $t2 is null , exit loop and print output

move $a0,$t2 # Convert $t2 to lower, if it is upper case

jal convert2lower

move $t2,$v0 # Store the return($v0) value into $t2

move $a0,$t3 # Convert $t3 to lower, if it is upper case

jal convert2lower

move $t3,$v0 # Store the return($v0) value into $t3

bne $t2,$t3,next_char2 # If both characters are not matched current

# character in the string, go to next character

addiu $t0,$t0,1 # otherwise, increment both indexes

addiu $t1,$t1,1

j loop2 # go to starting of the loop

next_char2:

la $t5,sword

bne $t5,$t1,nstart2

la $t1,sword # Store the input word into $t1

addiu $t0,$t0,1 # Increment the index to goto next character

j loop2 # go to starting of the loop

inc_counter2:

addi $t4,$t4,1 # Increment the frequency counter by 1

la $t1,sword # Store input word into $t1

j loop2 # go to starting of the loop

print_output2:

la $t0,sword

L2:

lb $a0,($t0)

beq $a0,'\n',exL2

jal convert2upper

move $a0,$v0

li $v0,11

syscall

addiu $t0,$t0,1

j L2

exL2:

la $a0,colon

li $v0,4

syscall

la $a0, dash2

li $v0, 4

syscall

move $a0,$t4

li $v0,1

syscall

exit:

# Otherwise, end the program

li $v0, 10 # Service 10 = exit or end program

syscall

############################ subroutine - convert2lower #################################

convert2lower: # Converts a character(stored in $a0) to

# its lower case, if it is upper case

# and store the result(lower case) in $v0

move $v0,$a0

blt $a0,'A',return

bgt $a0,'Z',return

subi $v0,$a0,-32

return: jr $ra # Return the converted(lower case) character

############################## subroutine - convert2upper ##################################

convert2upper: # Converts a character(stored in $a0) to

# its upper case, if it is lower case

# and store the result(upper case) in $v0

move $v0,$a0

blt $a0,'a',return2

bgt $a0,'z',return2

addiu $v0,$a0,-32

return2: jr $ra # Return the converted(lower case) character

4 0
3 years ago
For this lab, you will work on a simple GUI application. The starting point for your work consists of four files (TextCollage, D
Bad White [126]

The answer & explanation for this question is given in the attachment below.

Download docx
4 0
3 years ago
*
asambeis [7]

Answer:

I think they're all valid but the validility depends on the website your using the usernames on.

Explanation:

6 0
3 years ago
Match the word/s to its description.
dem82 [27]

Answer:

Explanation:

stands for a pure color -> ____value

expresses the brightness or dullness of a color -> ____hue

defines a range from dark (0%) to fully illuminated (100%) -> ____intensity

refers to how much black or white a color contains -> ____lightness

3 0
3 years ago
Jamal wants to create a program that will play music during the afternoon. Which kind of loop should be used in the program?
Colt1911 [192]

Answer:

i could be completely wrong, but my guess is "while"

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • A student dissolves some solid sodium hydroxide in a beaker of water.
    5·2 answers
  • Scale-based classification for networks allows us to differentiate PANs, LANs, MANs, and WANs. Moreover, the structure of a netw
    6·1 answer
  • For this exercise, you are given a phrase. Return the number of time the word “dog” appears in the phrase.
    7·1 answer
  • Weak Induction
    8·1 answer
  • In the RSA system, the receiver does as follows:1. Randomly select two large prime numbers p and q, which always must bekept sec
    6·1 answer
  • Anyone know what I’m supposed to do?
    11·1 answer
  • 6) Read the article posted on The Verge entitled How to fight lies, tricks, and chaos online and summarize the four steps. Then
    15·1 answer
  • Which item best describes fiber optic transmission?
    14·1 answer
  • A data table is a range that displays what?
    15·2 answers
  • Does any one know how to do addition of binary numbers​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!