Demo entry 6771856

Exercise 5 - Tair Ben Moshe

   

Submitted by tair ben moshe on Nov 21, 2018 at 10:20
Language: Python. Code size: 1.2 kB.

""" Tair Ben Moshe - 308015494
 exrecise #5 """

#1
def animals_number(word):
    animals_number = word.split
    dict={}
    for i in animals_number:
        if i not in dict:
            numb = animals_number.count(i)
            dict[i]=numb
    return dict

#2
def dict_invert(dict1):
    newdict ={}
    keys = dict1.key()
    values = dict1.values()
    new_values = set(values)
    for key in new_values:
       list1=[]
       for val in keys:
           if dict_invert[val]==key:
               list1.append(val)
               newdict[key]=list1
    return newdict

#3
import math
from math import fabs
print ("q3.2 ansver")
print ("3.45=",math.fabs(3.45))
print ("-13",math.fabs(-13))
print ("0=",math.fabs(0))

from math import exp
print ("q3.3 answer")
print (exp(25))

from math import log
c=math.log(25,-4)
p=math.pi

#1
#A
import requests
r=requests.get('https://www.google.com')
#B
x=r.text 
#c
def q4(s,word):
    r=requests.get(s)
    print ("the length is: ",len(r.text))
    print (word, "is", r.text.count(word),"in yhe URL")
    return (r.text.count(word), len(r.text))
    

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).