# Write a python program that asks for user input and prints the given input - Python

Categories:
Viewed: 3 - Published at: a few seconds ago

### Write a python program that asks for user input and prints the given input

``````a = input("User Input")
print(a)
``````

### Write a python function shifts and scales all numbers in the given list by the given mean and standard deviation

``````def shift_and_scale(list_of_nums, mean, std):
return [ (x-mean) / std for x in list_of_nums ]
``````

### Write a python function that takes in a list of sequences and zips each corresponding element from the list into a tuple and returns the list of such tuples

``````def zip_(list_of_seq):
return list(zip(*list_of_seq))
``````

### Write a python program that asks user to guess a number between 1 and 5 and guess it within 3 guesses

``````print("Please guess a number between 1 and 5 and I will guess within 3 chances!")
guess1 = input("Is it <= 3? enter y/n \n")
if guess1 == "y":
guess2 = input("Is it <= 2? enter y/n \n")
if guess2 == "y":
guess3 = input("Is it 1? enter y/n \n")
if guess3 == "y":
print("Yay! found the number, its 1")
else:
print("Yay! found the number, its 2")
else:
print("Yay! found the number, its 3")
else:
guess2 = input("Is it 4? enter y/n \n")
if guess2 == "y":
print("Yay! found the number, its 4")
else:
print("Yay! found the number, its 5")
``````

### Write python program that would merge two dictionaries by adding the second one into the first

``````a = {"a": 1, "b": 3}
b = {"c": 1, "d": 3}
a.update(b)
``````

### Write a python function that would reverse the given string

``````def reverse_string(str_to_be_reversed):
return str_to_be_reversed[::-1]
``````

### Write a python program that would print "Hello World"

``````print("Hello World")
``````

### Write a python program that would swap variable values

``````a = 10
b = 15
a, b = b, a
``````

### Write a python program that iterates over a dictionary and prints its keys and values

``````a = {"a":1, "b":2, "c":3, "d":4}
for k, v in a.items():
print(k, v)
``````

### Write a python program that iterates over a dictionary and prints its keys and values

``````def print_ascii(char):
print(ord(char))
### Write a python program that iterates over a dictionary and prints its keys and values
``````