Skip to content

Latest commit

 

History

History
108 lines (64 loc) · 1.99 KB

README.md

File metadata and controls

108 lines (64 loc) · 1.99 KB

Learning_Python

More Exercise

Exersise 1

Print characters from a string that are present at an even index number

string = "schokolade"

def print_Even_Number():
	# your code

Solution Exercise 1

Exercise 2

Print "True" if the first and last number of a list is the same

numbers_x = [10, 20, 30, 40, 10]
numbers_y = [75, 65, 35, 75, 30]

def last_same_as_first(numbers):
	# your code

Exercise 3

Return the count of a given substring (not case sensitive) from a string.

str = "Spiderman is not even a real spider"
sub_str = "spider"
def spider_counter(str, sub_str):
	# your code

Exercise 4

Create a new list from a two list using the following condition.

Given a two list of numbers, write a program to create a new list such that the new list should contain odd numbers from the first list and even numbers from the second list.

list1 = [10, 20, 25, 30, 35]
list2 = [40, 45, 60, 75, 90]

def combine_lists(list1,list2):
	# your code

Exercise 5

Return a random greeting and question from data.json

def random_greeting():
	# your code
	return greeting

Exercise 6

List all answers found in data.json under the 5th question in a Markdown Table

Markdown Cheatsheat

def answers_to_markdown():
	# your code

Exercise 7

Open a new file yahoo_users.py.

Return the percentage of users in table.csv who have their mail hosted by "yahoo.com".

round to 2 decimals e.g. 42,02

def who_uses_yahoo():
	# your code
	return percentage

Exercise 8

Run all previous functions from a single file depending on a User input.

E.g. List all options that can be run with a co-responding number. Then the user inputs the color and the function runs.

Tipps:

  • make use of imports
  • use case switches