Question

A. Perimeter of a Rectangle time limit per test 1 second memory limit per test: 256 megabytes input standard input output sta

Iwant answer this using number. Airthemitics. Varibles by python

B. Dividing Apples time limit per test 1 second memory limit per test: 256 megabytes input standard input output standard out


This using if else in python

C. Picky Bob time limit per test 1 second memory limit per test: 256 megabytes input standard input output standard output Bo

The third picture using if. Elif. Else

D. Square Number time limit per test: 1 second memory limit per test: 256 megabytes input standard input output standard outp

This using for loop in python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A. Perimeter of a Rectangle code

a = int(input())    #taking integer input and storing in a lenght
b = int(input())    #taking integer input and storing in b width
p = 2*(a + b)       #Perimeter = 2*(length + width)
print(p)            #printing the perimeter

Code Screenshot:

Output:

B. Dividing Apples code

a = int(input())    #taking integer input and storing in a (friend 1 apples)
b = int(input())    #taking integer input and storing in b (friend 2 apples)
if (a+b)%2 == 0:    #if (a+b) is divisible by 2 i.e (a+b)%2==0 then they can
    print("YES")    #be shared so printing YES
else:               #else printing NO
    print("NO")

Code Screenshot:

Output:

C. Picky Bob code

n = int(input())    #taking integer input and storing it in n
if n%10 == 0:       #n%10 returns the ones place digit if it's 0
    print("SUPER")  #then printing SUPER
elif n%10 == 5:     #if last digit is 5 printing GOOD
    print("GOOD")
else:
    print("OK")     #if any other digit then printing OK

Code Screenshot:

Output:

D. Square Number code

n = int(input())    #taking integer input
flag = False        #initially assuming it as not a square number 
for i in range(1, n+1): #for i from 1 to n
    if i*i == n:    #if i^2 equals to n then turning flag to true
        flag = True
        break       #ending the loop as we already found i
if flag == True:    #if flag is true then n is a square number print yes
    print("YES")
else:               #else print no 
    print("NO")

Code Screenshot:

Output:

Each and everything is explained in the comment section of the code.

Thank you! Hit like if you like my work.

Add a comment
Know the answer?
Add Answer to:
Iwant answer this using number. Airthemitics. Varibles by python This using if else in python The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I want this using while loop This using stringin python Use list or some thing in...

    I want this using while loop This using stringin python Use list or some thing in python Using list in python I want answer as soon as posdible E. Last Number time limit per test: 1 second memory limit per test: 256 megabytes input standard input output standard output You are given a sequence of positive integers aj, , 03, ... Print the last element of the sequence. Input The input consists of multiple lines. The i-th line contains a...

  • Plz i want answer these question using list in python programme. You are given two sequences...

    Plz i want answer these question using list in python programme. You are given two sequences of n integers: 21, 22, ...,an and b1,b2, ..., bn Print a sequence of 2n integers created by alternating elements from the given sequences: a1, 61, 42, 62, a3, 63, ..., an, bn. Input The first line contains a positive integer n (1 <n<1000) - the length of the sequences The second line contains n space-separated integers 01, 02, ..., an (-1000 <a; <...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list : You are given a non-decreasing sequence of n positive integers a1,a2,…,an. Print the number of distinct values in the sequence. For example, if the sequence is 1,2,2,2,3,4,4,5,7,10, the answer is 6 since distinct values are 1,2,3,4,5,7,10. Input The first line contains a positive integer n (1≤n≤1000) — the length of the sequence. The second line contains n space-separated positive integers a1,a2,…,an (1≤ai≤1000)...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : i have 15 min to submit the solution please help me   You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other...

  • Please solve it by Python 3 Write a program that asks the user for a positive...

    Please solve it by Python 3 Write a program that asks the user for a positive integer limit and prints a table to visualize all factors of each integer ranging from 1 to limit. A factor i of a number n is an integer which divides n evenly (i.e. without remainder). For example, 4 and 5 are factors of 20, but 6 is not. Each row represents an integer between 1 and 20. The first row represents the number 1,...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list : You are given a sequence of n positive integers a1,a2,…,an, where n is even. Swap adjacent elements in the given sequence and print the resulting sequence: a2,a1,a4,a3,a6,a5,… Input The first line contains a positive even integer n (2≤n≤1000) — the length of the sequence. The second line contains n space-separated integers a1,a2,…,an (1≤ai≤1000) — the elements of the sequence. Output Print n...

  • write a program in java to print all the powers of 2 below a certain number...

    write a program in java to print all the powers of 2 below a certain number and calculate their sum. Make sure your program conforms to the following requirements. 1. Accept the upper limit from the user (as an integer). 2. These numbers grow very fast. make sure the sum variable is of the "long" type. You can assume that the test output will be less that LONG MAX. 3.Print all numbers as a running sum, and finally print their...

  • Swapping Values in python Summary In this lab, you complete a Python program that swaps values...

    Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....

  • C Programming Language The code below matches the sample input/output but is marked wrong. Are there...

    C Programming Language The code below matches the sample input/output but is marked wrong. Are there other ways to do this problem? The focus is on recursion and functions. #include<stdio.h> int joCheck(unsigned long long int number) { if(number % 7 == 0 || number % 8 == 0) { return 1; } else return 0; } int main() { int cases = 0; scanf("%d", &cases); for(int i = 1; i<=cases; i++) { unsigned long long int number; scanf("%d", &number); if(joCheck(number)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT