Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

How do I extend to convert an integer to a character by using the 'chr()' function, and output that character

$
0
0

I'm having trouble in the 3rd part of my Scripting homework.1.23 LAB: Warm up: Variables, input, and type conversion(1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space.(2) Extend to also output in reverse. (3) Extend to convert the integer to a character by using the 'chr()' function, and output that character.It seems to come up fine when I run the program but when I submit for grading I get 0 points. Here's my code:

user_int = int(input('Enter integer (32 - 126):\n'))user_float = float(input('Enter float:\n'))user_char = input('Enter character:\n')user_str = input('Enter string:\n')print(str(user_int) +" " + str(user_float) +" " + str(user_char) +" " + user_str)print(str(user_str) +" " + str(user_char) +" " + str(user_float) +" " + str(user_int))print(str(chr(user_int)) +" " + str(user_float) +" " + str(user_char) +" " + user_str)

Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>