Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

This program prompts the user for two numbers, calls a function to determine the smaller number and prints the smaller number that is returned from the function

# This program prompts the user for two numbers,
# calls a function to determine the smaller number
# and prints the smaller number that is returned from the function

def getSmaller(num1, num2):
    if num1<num2:
        smaller = num1
    else:
        smaller = num2
    return smaller

def main():
    userInput1 = int(input("Enter a number: "))
    userInput2 = int(input("Enter a second number: "))
    
    smallerNumber = getSmaller(userInput1,userInput2)
    print("The smaller of the two numbers is", smallerNumber)


###call to main program####
main()
print("Done!")
Comment

PREVIOUS NEXT
Code Example
Typescript :: why are inline scripts not working anymore on HTML 
Typescript :: typescript split/partition array by condition 
Typescript :: how to find out the amount of ints in c++ 
Typescript :: React import multiple components from a folder 
Typescript :: does casting have a higher precedence than dots java 
Typescript :: can we do system testing at any stage 
Typescript :: network analysis projects code python graph and histogram with data facbook 
Typescript :: .htaccess Forcing scripts to display as source code 
Typescript :: how to get both key and value of enum in typescript 
Typescript :: pptxgenjs table 
Typescript :: take two inputs from user and add them using callback function 
Typescript :: js convert to typescript online 
Typescript :: Pick<Pick<Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement, HTMLDivElement 
Typescript :: how to send attachments to api 
Typescript :: what are the parts of an array called 
Typescript :: Modify the program so it also prints the number of A, T, C, and G characters in the sequence in python 
Typescript :: scale a vector 
Typescript :: react dynamic inputs with id 
Typescript :: check if an element exists laravel 
Typescript :: swift charts margins 
Typescript :: 5 lakes of north america 
Typescript :: whats app link target blank 
Typescript :: jquery to typescript converter online 
Typescript :: facts about poutine 
Typescript :: graphql?query={__schema{types{name,fields{name}}}} 
Typescript :: reports for market research 
Typescript :: redux toolkit socket io 
Typescript :: Access - Open form non data entry mode 
Typescript :: calculate north south east west using magnetic sensor 
Typescript :: how to remove dots in unordered list html 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =