COP 4814 Lab #1 - Coding Questions in Python Only Python version 3 is allowed. Have fun! Name(s): PantherID(s): 1. Write a Python program that finds all numbers that are divisible by 7 but not a...

1 answer below »
I have attached a file with 12 questions to be answered in python.


COP 4814 Lab #1 - Coding Questions in Python Only Python version 3 is allowed. Have fun! Name(s): PantherID(s): 1. Write a Python program that finds all numbers that are divisible by 7 but not a multiple of 5 between 2000 and 3201 (included). 2. Write a function in Python that generates a dictionary with the format i : i ∗ i given a certain integer number n. For instance, if the function is called on 3, then the dictionary should have the following format: 1: 1, 2: 4, 3: 9. 3. Write a function in Python that takes in parameters name and age. The function should return a message (it can be a print statement) containing the year when that person with that age will turn (or turned) 100 years old. 4. Write a function in Python that takes in as input a certain number and then prints out a list of all the divisors of that number. 5. Write a function in Python that takes in a list (example: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]) as input and returns a new list that has only the even elements of this list in it. 6. Given 2 lists, a and b, containing integers, not necessarily with the same length, Write a function in Python that returns a list that contains only the elements that are common between the lists a and b (without duplicates). 7. Write a function in Python that takes in a dictionary and returns the sum of all the values (not keys) in a dictionary. 8. Given a number n, write a function in Python to determine if n is a prime. 9. Given a string, write a function in Python that takes in a string and: if the length of the string is at least 3, adds ”ing” to its end. But, if it already ends in ”ing”, adds ”ly” instead. And if the string length is less than 3, leaves it unchanged. Return the resulting string. 10. Write a function in Python that takes a character and returns its ASCII value. 11. Write a function in Python that takes in an integer n and returns the first n Fibonnaci numbers. 12. Write a Python script that implement a function that takes as input three variables, and returns the largest of the three. Do this without using the Python max() function! Hint: Use if statements.
Answered Same DayJan 31, 2021

Answer To: COP 4814 Lab #1 - Coding Questions in Python Only Python version 3 is allowed. Have fun! Name(s):...

Neha answered on Jan 31 2021
155 Votes
75144 - python code/question 1.py
for i in range(2000,3202):
if(i % 7 == 0 and i % 5 !=0):
print(i)
75144 - python code/question 10.py
def asciiValue(char):
result = ord(char)
print(result)
char = input("Enter character:")
print("ASCII value: ")
asciiValue(char)
75144 - python code/question 11.py
def fibonacciSeries(number):
f1 = 0
f2 = 1
if (number < 1):
return
print(f1, end=" ")
for x in range(1, number):
print(f2, end=" ")
next = f1 + f2
f1 = f2
f2 = next
number = int(input("Enter number to calculate fibonacci series:"))
fibonacciSeries(number)
75144 - python code/question 12.py
def maxNumber(number1, number2, number3):
if (number1 >= number2) and (number1 >= number3):
print(number1," is the largest number")
elif (number2 >= number1) and (number2 >= number3):
print(number2," is the largest...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here