Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . What is the difference between is operator and = = operator? Explain with an example. 2 . Convert the below binary numbers into

1.
What is the difference between is operator and == operator? Explain with an example.
2.
Convert the below binary numbers into decimal.
a)10100011
b)101101
c)110100101010
3.
Convert the below decimal numbers into binary. a)239
b)66
4.
Write a program that prints the integers from 1 to 100. But for multiples of three print "Fizz" instead of the number, and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print FizzBuzz.
First few lines of the output:
1
2
Fizz 4
Buzz Fizz 7
8
Fizz Buzz 11
Fizz 13
14
FizzBuzz
.
.
.
Declare two integers. Print the lesser of two given numbers if both numbers are even, but print the greater number if one or both the numbers are odd.
Input-1:
number_one =40
number_two =50 Output-1:
40
Input-2:
number_one =403
number_two =5003 Output-2:
5003
Input-3:
number_one =40
number_two =5003 Output-3:
5003
6.
Declare a two-word string separated by space. Print True if both the words begin with the same letter (case-sensitive) otherwise print False.
Input-1:
input_string = 'Hello World' Output-1:
False
Input-2:
input_string = 'Jumping Jack Output-2:
True
Input-3:
input_string = 'Jumping jack Output-3:
False
7.
Enhance question #6 to include case-insensitive comparison. Input:
input_string = 'Jumping jack Output:
True
Use for,.split(), and if to print out words that start with b(case-sensitive).
Input:
'You cannot end a sentence with because because because is a conjunction.' Output:
because because because
9.
Enhance question #8 to include case-insensitive comparison and remove duplicates from the output.
Input:
'You cannot end a sentence with because Because because is a conjunction.' Output:
because Because
10.
Write a Python program to swap two variables. Input:
first_num =10
second_num =20 Output:
first_num =20
second_num =10
[Bonus Questions: They will not be graded]
1.
Given a list of integers, return indices of the two numbers such that they add up to a specific target.
Given nums =[2,7,11,15], target =9, Because nums[0]+ nums[1]=2+7=9, return [0,1].
2.
Without using swapcase(), You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa.
Input: McDonalds Output: mCdONALDS
Write a Python program to convert decimal number to binary. Input: 239
Output: 11101111

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

p* is a competitive equilibrium price if z(p*) 0.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago