Answer:
Following are the code to this question:
val={} #defining dictionary variable val
def unique_word(i):#defining a method unique_word
if i in val: #defining if condition to add value in dictonary
val[i] += 1#add values
else: #defining else block to update values
val.update({i: 1})#updating dictionary
s =input('Enter string value: ') #defining s variable for input string value
w=s.split()#split string value and sorte in w variable
w.sort() #sorting the value
for i in w: #defining loop for pass value in method unique_word
unique_word(i)#assign value and calling the unique_word method
for j in val:# defining for loop to print dictionary value
if val[j] == 1: #defining if block to check value is unique
print(j) #print value
Output:
Enter string value: my name is dataman
dataman
name
is
my
Explanation:
-
In the above python code, a dictionary variable "val" is declared, which is used in the method "unique_word" that uses if block to count unique word and in the else block it update its value.
-
In the next step, s variable is declared, that the user input method to store the value and another variable "w" is defined that split and sort the string value.
- In the last step, two for loop is declared in which the first loop passes the string value and calls the method "unique_word", and in the second loop if block is defined that check unique value and prints its value.
You can edit the contents of a cell directly in the cell. You can also edit the contents of a cell by typing in the formula bar.
When you edit the contents of a cell, Excel is operating in Edit mode. Some Excel features work differently or are unavailable in Edit mode.
Profile let's go with profile hope this helps
Answer:
Following are the code to this question:
def binarynumber(num):#defining a method binarynumber that accepts a parameter num
x=""#defining a string variable x
if (num!=0):#defining if condition to check number not equal to 0
while (num>=1):#defining a loop that check value is grater then equal to one
if (num %2==0):#defining if condition to check num is even
x=x+"0" #add string value 0 in num variable
num=num/2 #divide the value by 2
else:#defining else block
x=x+"1"#add string value 1 in num variable
num=(num-1)/2#first subtract 1 into num variable then divide the value by 2
else:
x="0"#assign string value 0 in num variable
return "".join(reversed(x))#return value
num = int (input ("Enter any number: "))#defining num variable that input the integer value
print (binarynumber(num))#using print method to call method binarynumber with passing num parameter
Output:
Enter any number: 12
1100
Explanation:
- In the above python code a method "binarynumber" is declared, in which the "num" variable passes as the parameter inside the method a string variable "x" is declared that stores all converted values.
- Inside the method and if the block is declared that checks number value is not equal to 0 if this condition is false then it will add string value and reverse its value.
- Or if the condition is true it defines a while loop that calculates the given number binary digits and returns its value.
- At the last step, the num variable is declared that inputs the integer value from the user end and calls the method by using the print method.
The part of an I-statement that involves a description of
your needs or feelings is the Feelings Statement.
The feelings statement is a description of your feelings that is linked to a
particular situation. Vague feelings often create frustration in the listener.